Created
December 17, 2018 17:58
-
-
Save jrgleason/6c23cdbc52e4e9eec2af4ba63d6ba115 to your computer and use it in GitHub Desktop.
ES6 Selenium Driver not working with mocha
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
}); | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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"); | |
}); | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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