Locating strategy by Tag Name

What is Tag?

Yes. Tag is the formatting command of the Web Page. This is the heart of the HTML page design. HTML tags include tag for table, tag for input text, tag for paragraph, tags for heading, tag for titles etc. This is enclose by    < > and come in pair to specifying beginning and ending.

Now You are clear what is Tag. How you will traverse through Tag to locate an element of the web page.

See the below code.


Scenario with Example:

import org.openqa.selenium.By; 
import org.openqa.selenium.WebDriver; 
import org.openqa.selenium.WebElement; 
import org.openqa.selenium.chrome.ChromeDriver;   
public class Locator_By_ID {   
public static void main(String[] args) 
WebDriver driver= new ChromeDriver() ; 
login_button= driver.findElement(By.tagName("Name of the Tag"));

Leave a Reply

Your email address will not be published. Required fields are marked *