Finding elements in Web Page - Part I
Finding elements using the id, name, class name, link text, partial link text and tag name. i. Finding elements using the ID attribute: To implement we will follow this url: https://testpages.herokuapp.com/styled/find-by-playground-test.html After loading this URL in your browser right click on the selected text and then click on Inspect as shown in the following screenshot: The structure of the element will be showing as highlighted. In our case the id for the selected text is "p1". In Java the syntax for selecting the "p1" id will be following: driver.findElement(By.id(<element ID>)) ii. Find elements using the name attribute Right click on the selected text and click Inspect then we can find the name attribute for the selected text as shown in following screenshot: Here the name attribute to located the selected element is "pName2". In Java the syntax for selecting the " pName2 " id will be following: driver.findElement(By.name(<e...