Styrow.dev
Question 18 of 64

How to click on a hyper link using linkText?

Question

How to click on a hyper link using linkText?

Answer

driver.findElement(By.linkText(“Google”)).click();

The command finds the element using link text and then click on that element

We also can use partialLinkText method to find hyperlink

driver.findElement(By.partialLinkText(“Goo”)).click();