Skip to content

Instantly share code, notes, and snippets.

@austbot
Last active April 6, 2018 16:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save austbot/704d5d32eca3f41c53a183d4b65369ac to your computer and use it in GitHub Desktop.
Save austbot/704d5d32eca3f41c53a183d4b65369ac to your computer and use it in GitHub Desktop.
const {Builder, By, Key, until, Capabilities} = require('selenium-webdriver');
(async function example() {
let c = Capabilities.firefox();
c.setAcceptInsecureCerts(true);
let driver = new Builder()
.forBrowser('firefox')
.withCapabilities(c)
.usingServer('http://localhost:4444/wd/hub')
.build();
try {
await driver.get(process.env.LOGIN_URL);
await driver.findElement(By.name('username')).sendKeys(process.env.USERNAME);
await driver.findElement(By.name('password')).sendKeys(process.env.PW);
await driver.sleep(1000);
await driver.findElement(By.className('btn')).click();
await driver.sleep(2000);
await driver.findElement(By.tagName('body')).sendKeys("dk");
await driver.get(process.env.AUTHED_URL);
} finally{
await driver.sleep(2592000);
driver.close()
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment