-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
610 additions
and
2 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
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,44 @@ | ||
import { Browser, Builder, By, Key, until } from "selenium-webdriver" | ||
|
||
import { path } from "chromedriver" | ||
import { getBinaryPaths } from "selenium-webdriver/common/driverFinder" | ||
import Chrome from "selenium-webdriver/chrome" | ||
describe("base selenium test", () => { | ||
it.skip("works", async () => { | ||
// referenced: https://www.npmjs.com/package/selenium-webdriver | ||
console.log(path) | ||
|
||
let options = new Chrome.Options(); | ||
options.setBrowserVersion("stable") | ||
|
||
let paths = getBinaryPaths(options) | ||
let driverPath = paths.driverPath; | ||
let browserPath = paths.browserPath; | ||
console.log(paths); | ||
|
||
options.setChromeBinaryPath(browserPath) | ||
|
||
let service = new Chrome.ServiceBuilder().setPath(driverPath); | ||
|
||
let driver = await new Builder().forBrowser(Browser.CHROME) | ||
.setChromeOptions(options) | ||
.setChromeService(service) | ||
.build(); | ||
|
||
console.log("got here"); | ||
|
||
try { | ||
await driver.get('https://www.google.com/ncr') | ||
console.log("got here"); | ||
await driver.findElement(By.name('q')).sendKeys('webdriver', Key.RETURN) | ||
console.log("got here"); | ||
await driver.wait(until.titleIs('webdriver - Google Search'), 1000) | ||
console.log("got here"); | ||
} finally { | ||
await driver.quit() | ||
} | ||
}, 60000) | ||
}) | ||
|
||
|
||
|
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,16 @@ | ||
// require('chromedriver'); | ||
const { Builder, By, Key, until } = require('selenium-webdriver'); | ||
(async function test() { | ||
const builder = new Builder().forBrowser('chrome'); | ||
console.log(builder.getChromeOptions()); | ||
|
||
let driver = await builder.build(); | ||
|
||
try { | ||
await driver.get('http://www.google.com'); | ||
await driver.findElement(By.name('q')).sendKeys('webdriver', Key.RETURN); | ||
await driver.wait(until.titleIs('webdriver - Google Search'), 1000); | ||
} finally { | ||
await driver.quit(); | ||
} | ||
})(); |
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
Oops, something went wrong.