In order to interact with the entire page source in C#, you need to use the PageSource property of the IWebDriver. This script shows a basic operation that uses the PageSource property to search for a specific string.
In order to interact with the entire page source in Java, you need to use the WebDriver method getPageSource() . This code sample shows a basic operation that uses the method to search for a specific string.
There are three ways of waiting for elements: explicit wait, implicit wait and fluent wait.
Implicit wait will simply wait for a specified amount of time, returning the element if it is found when the timer runs out.
var title = js.ExecuteScript("return document.title");
The following code shows how to open a link in a new tab using element.SendKeys(...) in the first example. This code more accurately models human behaviour compared to the following example as it directly models human behaviour.
To get the text entered into an input element, use element.getAttribute("value") where element is the input element. The attribute text is used to get the text from the tags within an element.
IWebElement query = driver.FindElement(By.Id("searchInput")); query.SendKeys("the moon"); MxService.AddLogLine(query.GetAttribute("value"));
To mouse over elements, you need to use the Actions class to build and perform the MoveToElement command.