문제

I want check a checkbox in Selenium WebDriver with java , but It returns an exception ElementNotVisibleException.Element is currently not visible ...

The element is invisible but not hidden. I tried it with both firefox and PhantomJS but it doesn't work.

I found many suggestions here but it still not work

HTML code :

<span class="checkbox"> 
<input id="terms-checkbox" class="required" type="checkbox" name="terms_agreement">
</input> 
<label for="terms-checkbox"></label>
</span>
도움이 되었습니까?

해결책

As mentioned in question, the element is not hidden but could not find. So, it may be visible through label tag. You should try with the below code:

driver.findElement(By.xpath("//label[@for='terms-checkbox']")).click();
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top