-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
/
Copy pathfirstScript.spec.js
35 lines (25 loc) · 1.12 KB
/
firstScript.spec.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
const { By, Builder } = require('selenium-webdriver');
const { suite } = require('selenium-webdriver/testing');
const assert = require("assert");
suite(function(env) {
describe('First script', function() {
let driver;
before(async function() {
driver = await new Builder().forBrowser('chrome').build();
});
after(() => driver.quit());
it('First Selenium script', async function() {
await driver.get('https://crossbrowsertesting.github.io/selenium_example_page.html');
let title = await driver.getTitle();
assert.ok(title.includes("Selenium"));
await driver.manage().setTimeouts({ implicit: 5000 });
let searchBox = await driver.findElement(By.name('text'));
let searchButton = await driver.findElement(By.id('submitbtn'));
await searchBox.sendKeys('Selenium');
await searchButton.click();
searchBox = await driver.findElement(By.id('form-results'));
let value = await searchBox.getText();
assert.ok(value.includes("Selenium"));
});
});
});