1#In Python
2
3#Let's say that we want to locate the h1 tag in this HTML:
4#<html>
5# <head>
6# ... some stuff
7# </head>
8# <body>
9# <h1 class="someclass" id="greatID">Super title</h1>
10# </body>
11#</html>
12
13h1 = driver.find_element_by_name('h1')
14h1 = driver.find_element_by_class_name('someclass')
15h1 = driver.find_element_by_xpath('//h1')
16h1 = driver.find_element_by_id('greatID')
17
1//required imports
2WebDriver driver = new ChromeDriver();
3WebElement objWE;
4//There are many way most common are id and xpath
5objWE = driver.findElement(By.id("String of id attribute"));
6//To find the xpath easily hit F12 and right click the element you want
7//and copy xpath then paste it
8objWE = driver.findElement(By.xpath("//*[@id="search"]/div[2]/div[6]/div[1]/div/div"));
1List<WebElement> elementName = driver.findElements(By.LocatorStrategy("LocatorValue"));