-
Notifications
You must be signed in to change notification settings - Fork 0
WebEvents
The WebEvents class contains two types of actions, activities or methods, depending on your background:
- JavaScript.
- Selenium.
The WebEvents class is specialized only from Web Interactions and nothing else (as the name implies).
To be able to use this class, you will need to know how to write your own XPaths, however, I recommend you as a helper tool SelectorsHub Chrome extension as training wheels, there is also this tutorial you can find here that can teach you everything you need to know about XPaths: https://www.w3schools.com/xml/xpath_intro.asp.
This subclass contains all of the methods that interact with the browser in JavaScript .
They are very agile and powerful and I recommend you use them only as a last resort.
Don't use a chainsaw to cut salmon.
This method will trigger a JavaScript hover event on the element it finds.
Mandatory Parameters | Optional Parameters |
---|---|
ChromeDriver chromeDriver | int retries (default:15) |
string xPath | int retryInterval (default 1) |
Example:
WebEvents.ActionJs.Hover(chromeDriver, "//*[@id='wiki-wrapper']/div[1]/h1");
This method will search for an element in a web page until it can no longer find it, forever.
Mandatory Parameters | Optional Parameters |
---|---|
ChromeDriver chromeDriver | int retryInterval (default 1) |
string xPath |
Example:
WebEvents.ActionJs.WaitForeverElementVanish(chromeDriver, "//*[@id='wiki-wrapper']/div[1]/h1");
This method will search for an element in a web page until it can no longer find it.
Mandatory Parameters | Optional Parameters |
---|---|
ChromeDriver chromeDriver | int retries (default 60) |
string xPath | int retryInterval (default 1) |
Example:
WebEvents.ActionJs.WaitElementVanish(chromeDriver, "//*[@id='wiki-wrapper']/div[1]/h1");
This method will search for either the text or the value of an element and return it.
Mandatory Parameters | Optional Parameters |
---|---|
ChromeDriver chromeDriver | int retries (default 15) |
string xPath | int retryInterval (default 1) |
Example:
var textValue = WebEvents.ActionJs.GetText(chromeDriver, "//*[@id='wiki-wrapper']/div[1]/h1");
This method will set the value of an element.
Mandatory Parameters | Optional Parameters |
---|---|
ChromeDriver chromeDriver | int retries (default 15) |
string xPath | int retryInterval (default 1) |
string text |
Example:
WebEvents.ActionJs.SetValue(chromeDriver, "//*[@id='wiki-wrapper']/div[1]/h1", "myNewValue");
This method will click on an element.
Mandatory Parameters | Optional Parameters |
---|---|
ChromeDriver chromeDriver | int retries (default 15) |
string xPath | int retryInterval (default 1) |
string text |
Example:
WebEvents.ActionJs.Click(chromeDriver, "//*[@id='wiki-wrapper']/div[1]/h1", "myNewValue");
This subclass contains all of the methods that interact with the browser in JavaScript.
They are very agile and powerful and I recommend you use them only as a last resort.
Don't use a chainsaw to cut salmon.
This method will find all the children of an element.
Mandatory Parameters |
---|
ChromeDriver chromeDriver |
WebElement element |
Example:
var allChildren = WebEvents.SearchJs.FindAllChildren(chromeDriver, element);