2
I’m running a test with testNG along with Selenium
org.openqa.selenium.By
Test, do this search:
driver.findElement(By.id("idRoleCheck:0")).click();
Gives the following error:
org.openqa.Selenium.Elementnotvisibleexception: element not Visible
Analyzed with the Chrome development tool, you have the Id, I can see it, but I think it’s this character’s problem ":" , but I don’t know, I’ve tried several searches around here and other places and nothing.
I’m using the driver:
org.openqa.selenium.chrome.ChromeDriver
Someone’s been through it?
HTML generated in the browser:
<div class="ui-helper-hidden-accessible">
<input id="idRoleCheck:0" name="idRoleCheck" value="value"
onchange="PrimeFaces.ab({s:"idRoleCheck",e:"change",p:"idRoleCheck",u:"idRoleCheck"});"
type="checkbox">
</div>
None of the answers so far have solved. But evolving we managed to pass the test.
driver.findElement(By.xpath("//table[@id='idRoleCheck']/tbody/tr/td/div/div[2]/span")).click();
The problem in reading the id in the way questioned continues, maybe it is missing some dependency that this generating the problem, because the log, never comes with much information (or it is anyway).
Using:
- Selenium 3.0.0-beta2
- Chromedriver 2.24
- Downloaded from here Chrome Driver 2.24
How the problem was found
Using:
- Selenium IDE (that firefox plugin to write test data)
- Exported to type (Testng / Java /Webdriver)
- It generates two lines, the first that gives the error (idRoleCheck:0)
- The second reading by By.xpath(...
Dude, I only used Selenium with Python but, have you ever tried to use it to catch with xpath instead of id? Or does it have to be ID msm? I think the xpath is more reliable, is more straight you know? Since you’re trying for ID and not rolling, maybe the xpath will work!
– Vanessa Nunes