Created
September 1, 2017 02:11
-
-
Save koola/428064def65e0334d5bc731ad9df1faa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BrowserActions { | |
click(element, timeout=5000) { | |
return this.waitForElementToBeClickable(element, timeout).then(() => { | |
return element.click(); | |
}) | |
} | |
waitForElementToBeClickable(ele, timeout=5000) { | |
return browser.wait(EC.visibilityOf(ele), timeout).then(() => { | |
return browser.wait(EC.elementToBeClickable(ele), timeout); | |
}); | |
} | |
waitForAllElement(ele, index, timeout=5000) { | |
return browser.wait(ele => ele.count>=index,timeout); | |
} | |
sendKeys(element, text, timeout=5000) { | |
return this.waitForElementToBeClickable(element, timeout).then(() => { | |
return element.clear().then(() => { | |
return element.sendKeys(text); | |
}); | |
}); | |
} | |
} | |
module.exports = new BrowserActions(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment