Skip to content

Instantly share code, notes, and snippets.

@erik-haartmans
Created November 5, 2017 00:00
Show Gist options
  • Save erik-haartmans/42f18751c34f7c62e025e79d1cd47841 to your computer and use it in GitHub Desktop.
Save erik-haartmans/42f18751c34f7c62e025e79d1cd47841 to your computer and use it in GitHub Desktop.
require('chromedriver');
const webdriver = require('selenium-webdriver');
const By = webdriver.By;
describe('selenum test - part 2', () => {
it('should be able to start a website', async () => {
let driver = new webdriver.Builder()
.forBrowser('chrome')
.build();
driver.manage().window().maximize();
await driver.navigate().to('https://techblog.polteq.com/testshop/index.php');
let searchField = await driver.findElement(By.id('search_query_top'));
searchField.sendKeys('iPod' + webdriver.Key.ENTER);
let result = await driver.findElement(By.className('heading-counter'));
let resultText = await result.getText();
resultText.should.equal('5 results have been found.');
await driver.quit();
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment