Styrow.dev
Question 18 of 82

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();


📲 Practice Offline on Mobile: Download the free QA Automation & SDET Prep app on Google Play & App Store.