How I can avoid "Element is not currently visible and so may not be interacted with " Selenium Webdriver

selenium, selenium-webdriver, webdriver

Solution

Are you sure you're looking at the right element? I had a similar problem and it turned out there were two similar elements on the page, one visible and the other not. The FindElement function was returning the one that wasn't visible.

I solved this by using FindElements instead of FindElement and then using Linq to extract the one that was visible.

Problem

Am using selenium webdriver 2.210 + JAVA for testing.I have a sample code for selecting all mails in gmail.But the code throws an "Element is not currently visible and so may not be interacted with" error when i tries to put a 5sec delay after getting URL through webdriver.Is it possible to make this code working with delay? ``` driver.get("https://mail.google.com/mail/u/0/?shva=1#all"); delay(5); ////*......Working fine without this...........*//// driver.switchTo().frame(driver.findElement(By.id("canvas_frame"))); driver.findElement(By.xpath("//div[@class = 'T-Jo-auh']")).click(); ``` Thanks in advance

Original source

Related problems