-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Sri Harsha <[email protected]>
- Loading branch information
Showing
1 changed file
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
const Chrome = require('selenium-webdriver/chrome'); | ||
const {Browser, Builder} = require("selenium-webdriver"); | ||
const {getBinaryPaths} = require("selenium-webdriver/common/driverFinder"); | ||
const options = new Chrome.Options(); | ||
|
||
describe('Service Test', function () { | ||
it('Default service', async function () { | ||
let service = new Chrome.ServiceBuilder() | ||
|
||
let driver = new Builder() | ||
.forBrowser(Browser.CHROME) | ||
.setChromeService(service) | ||
.build(); | ||
|
||
await driver.get('https://www.selenium.dev/selenium/web/blank.html'); | ||
await driver.quit(); | ||
}); | ||
|
||
it('Set Driver Location', async function () { | ||
|
||
let options = new Chrome.Options(); | ||
options.setBrowserVersion("stable") | ||
|
||
let paths = getBinaryPaths(options) | ||
let driverPath = paths.driverPath; | ||
let browserPath = paths.browserPath; | ||
|
||
options.setChromeBinaryPath(browserPath) | ||
|
||
let service = new Chrome.ServiceBuilder().setPath(driverPath) | ||
|
||
let driver = new Builder() | ||
.forBrowser(Browser.CHROME) | ||
.setChromeOptions(options) | ||
.setChromeService(service) | ||
.build(); | ||
|
||
await driver.get('https://www.selenium.dev/selenium/web/blank.html'); | ||
await driver.quit(); | ||
}); | ||
|
||
it('Set port', async function () { | ||
let service = new Chrome.ServiceBuilder().setPort(1234) | ||
|
||
let driver = new Builder() | ||
.forBrowser(Browser.CHROME) | ||
.setChromeService(service) | ||
.build(); | ||
|
||
await driver.get('https://www.selenium.dev/selenium/web/blank.html'); | ||
await driver.quit(); | ||
}); | ||
}); |