Hey Himanshu, as far as I can understand, you want to click the 2nd href link or <a> tag of any website by using Selenium. So you can perform following steps to do that:
- Navigate to the desired webpage
- Get list of WebElements with tagname 'a' using driver.findElements()-
List<WebElement> allLinks = driver.findElements(By.tagName("a"));
-
Now to open the href link, use click() method:
allLinks.get(1).click();