-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSeleniumActions.js
More file actions
28 lines (22 loc) · 820 Bytes
/
Copy pathSeleniumActions.js
File metadata and controls
28 lines (22 loc) · 820 Bytes
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
const { until, Key } = require('selenium-webdriver');
class SeleniumActions {
constructor(driver) {
this.driver = driver;
}
async loadUrl(url) {
await this.driver.get(url).catch(error => { throw(error) });
}
async enterTextAndPressEnterKey(locator, text) {
await this.driver.wait(until.elementLocated(locator), 8000)
.sendKeys(text)
.catch(error => { throw(error) });
}
async waitUntilPageTitleIsDisplayed(webPageTitle) {
await this.driver.wait(until.titleIs(webPageTitle), 4000).catch(error => { throw(error) });
}
async getInnerText(locator) {
return await this.driver.wait(until.elementLocated(locator), 4000).getText()
.catch(error => { throw(error) });
}
}
module.exports = SeleniumActions;