Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in DevOps and Agile by (19.7k points)

I have an html href link

<a href="/docs/configuration">App Configuration</a>

using Selenium I need to click the link. Currently, I am using below code -

Driver.findElement(By.xpath("//a[text()='App Configuration']")).click(); 

But it's not redirecting to the page. I also tried below code -

 Driver.findElement(By.xpath(//a[@href ='/docs/configuration']")).click();

But this is throwing below exception -

org.openqa.selenium.ElementNotVisibleException: Element is not currently visible and so may not be interacted with Command duration or timeout: 13 milliseconds

The link is visible and the page is completely loaded. Can anyone help with this?

1 Answer

0 votes
by (62.9k points)

webDriver.findElement(By.xpath("//a[@href='/docs/configuration']")).click();

The above line works fine. Please remove the space after href.

If the element is not visible please scroll down the page then perform click the action

If you wish to Learn Selenium visit this Selenium Webdriver Tutorial and Selenium Webdriver Interview Questions by Intellipaat.

To learn in-depth about Selenium, sign up for an industry based Selenium course.

Browse Categories

...