aspose file tools*
The moose likes Testing and the fly likes ElementNotVisibleException in selenium . how to get rid of that? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Testing
Bookmark "ElementNotVisibleException in selenium . how to get rid of that?" Watch "ElementNotVisibleException in selenium . how to get rid of that?" New topic
Author

ElementNotVisibleException in selenium . how to get rid of that?

linda russel
Ranch Hand

Joined: Jan 05, 2012
Posts: 86
_driver.findElement(By.xpath("//div[@id='D8006']/table/tbody/tr/td/a")).click();

i am trying to click a link in the page using the above line of code and i get a ElementNotVisibleException . how do i get rid of that?
linda russel
Ranch Hand

Joined: Jan 05, 2012
Posts: 86
is it a bug in the Selenium itself?
Brian Burress
Ranch Hand

Joined: Jun 30, 2003
Posts: 123
I have run into some quirks when it comes to using web driver and xpath involving frames, but from the message you are getting I think you might have a 'procedural issue'. ElementNotVisibleException is suggesting that your expression has located an element and it is clickable but you can't see it. If you were a user on the browser, you could not click something that could not be seen.

In your test scenario, what would a person using a browser do in order to see the element (hyperlink) to be able to click it? From there, create code to fire that same activity in the webdriver browser session before you try clicking the element. If you are using a browser implementation (i.e. not the headless html driver), you should be able to see the link be made visible in the UI.

One other consideration: If you can see the element right now, then check your HTML to make sure an invisible link matching this Xpath is not "jumping" ahead of you. If the value of the id is unique on the page then you should be ok.
linda russel
Ranch Hand

Joined: Jan 05, 2012
Posts: 86
Thanks Brian for your reply.


The problem was the element was not visible . The element is visible only when we bring the mouse on the element.

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ElementNotVisibleException in selenium . how to get rid of that?