-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
/
Copy pathbackAndForwardClick.spec.js
37 lines (26 loc) · 1.26 KB
/
backAndForwardClick.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
const {By, Button, Browser, Builder} = require('selenium-webdriver');
const assert = require('assert');
describe('Should be able to perform BACK click and FORWARD click', function () {
let driver;
before(async function () {
driver = new Builder().forBrowser('chrome').build();
});
after(async () => await driver.quit());
it('Back click', async function () {
await driver.get('https://selenium.dev/selenium/web/mouse_interaction.html');
await driver.findElement(By.id("click")).click();
assert.deepStrictEqual(await driver.getTitle(), `We Arrive Here`)
const actions = driver.actions({async: true});
await actions.press(Button.BACK).release(Button.BACK).perform()
assert.deepStrictEqual(await driver.getTitle(), `BasicMouseInterfaceTest`)
});
it('Forward click', async function () {
await driver.get('https://selenium.dev/selenium/web/mouse_interaction.html');
await driver.findElement(By.id("click")).click();
await driver.navigate().back();
assert.deepStrictEqual(await driver.getTitle(), `BasicMouseInterfaceTest`)
const actions = driver.actions({async: true});
await actions.press(Button.FORWARD).release(Button.FORWARD).perform()
assert.deepStrictEqual(await driver.getTitle(), `We Arrive Here`)
});
});