You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
845 B
33 lines
845 B
const { Browser } = require('selenium-webdriver')
|
|
const ChromeDriver = require('./chrome')
|
|
const FirefoxDriver = require('./firefox')
|
|
|
|
const buildWebDriver = async function buildWebDriver ({ browser, extensionPath, responsive, port }) {
|
|
switch (browser) {
|
|
case Browser.CHROME: {
|
|
const { driver, extensionId, extensionUrl } = await ChromeDriver.build({ extensionPath, responsive, port })
|
|
|
|
return {
|
|
driver,
|
|
extensionId,
|
|
extensionUrl,
|
|
}
|
|
}
|
|
case Browser.FIREFOX: {
|
|
const { driver, extensionId, extensionUrl } = await FirefoxDriver.build({ extensionPath, responsive, port })
|
|
|
|
return {
|
|
driver,
|
|
extensionId,
|
|
extensionUrl,
|
|
}
|
|
}
|
|
default: {
|
|
throw new Error(`Unrecognized browser: ${browser}`)
|
|
}
|
|
}
|
|
}
|
|
|
|
module.exports = {
|
|
buildWebDriver,
|
|
}
|
|
|