Skip to content

WebEvents.ActionJs

Avrigeanu Laurian edited this page Sep 5, 2022 · 4 revisions

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.

Hover (IWebElement)

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");

WaitForeverElementVanish (IWebElement)

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");

WaitElementVanish (IWebElement)

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");

GetText (String)

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");

SetValue (IWebElement)

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");

Click (IWebElement)

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");