Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Danielfenghk/2c5d5da3f62b6f4699c0053bccec7d61 to your computer and use it in GitHub Desktop.
Save Danielfenghk/2c5d5da3f62b6f4699c0053bccec7d61 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