Skip to content

Instantly share code, notes, and snippets.

@jrgleason
Created December 17, 2018 17:58
Show Gist options
  • Save jrgleason/6c23cdbc52e4e9eec2af4ba63d6ba115 to your computer and use it in GitHub Desktop.
Save jrgleason/6c23cdbc52e4e9eec2af4ba63d6ba115 to your computer and use it in GitHub Desktop.
ES6 Selenium Driver not working with mocha
import webdriver from "selenium-webdriver";
const url = process.env.TEST_UI_URL || "http://localhost:9090/";
const { By } = webdriver;
export class BasePage{
constructor(driver){
if(driver) this.driver = driver;
else{
console.log("Driver is undefined");
const builder = new webdriver.Builder()
.forBrowser("chrome");
this.driver = builder.build()
.then((d)=>{
console.log("Got driver");
return d;
});
}
}
}
(async () => {
let driver = await import("./WireDriver.mjs");
console.log(`Is driver loaded? ${JSON.stringify(driver)} ${driver.then == null}`);
driver.then((d)=>{
console.log(`asdsa ${typeof d} ${Object.keys(d.default)} ${Object.getOwnPropertyNames(d)}`);
d.get("http://google.com");
console.log("Made it there");
});
})
import {BasePage} from "./BasePage";
const page = new BasePage();
export default page.driver;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment