-
Book Overview & Buying
-
Table Of Contents
Selenium Essentials
By :
WebElement is an HTML element that helps the users to drive automation tests. Selenium WebDriver provides well-organized web page interactions through WebElements, such as locating elements, getting attribute properties, asserting text present in WebElement, and more. However, to interact with hidden elements in a web page, it is necessary to unhide the hidden elements first. Let's discuss Selenium WebElement functions further:
getText(): This function delivers the innerText attribute of WebElement. The following is the syntax for this function:
driver.findElement(By.locatorType("path")).getText();The following is an example on the Google page that returns the innerText attribute of a Google search button using the getText() function:
driver.get("https://www.google.com");
System.out.println(driver.findElement(By.id("_eEe")).getText());JavaScriptExecutor is a Selenium interface to execute JavaScripts that returns the innerText attribute of a hidden element. It is important...
Change the font size
Change margin width
Change background colour