-
Notifications
You must be signed in to change notification settings - Fork 0
/
testScript.spec.js
43 lines (35 loc) · 1.27 KB
/
testScript.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
36
37
38
39
40
41
42
43
const { By, Browser } = require("selenium-webdriver");
const assert = require("assert");
const { suite } = require("selenium-webdriver/testing");
suite(
function (env) {
describe("Google Search", function () {
let driver;
before(async function () {
driver = await new env.Builder().forBrowser("chrome").build();
});
after(async function () {
await driver.quit();
});
it("Google Search ", async function () {
await driver.get("https://www.google.com");
let title = await driver.getTitle();
assert.equal("Web Driver Test", title);
await driver.manager().setTimeouts({ implicit: 10000 });
let textBox = await driver.findElement(By.name("step-current"));
let submitButton = await driver.findElement(
By.css('button[type="submit"]')
);
await textBox.sendKeys("Google Search");
await submitButton.click();
let logs = await driver.manage().logs().get("browser");
console.log(logs);
let message = await driver.findElement(By.id("message"));
let value = await message.getText();
assert.equal("Google Search", value);
});
});
},
{ browsers: [Browser.CHROME, Browser.FIREFOX] }
);
// // Path: testScript.spec.js