Ksingh Ksingh - 2 years ago 80
HTML Question

Selenium can't find locator

See this imageI have a list of checkboxes which can be scrollable, but I can't find the actual locator. This is the HTML:

<a class="collection-item" href="#!" disabled="">
<input id="3" class="filled-in checkbox-orange" type="checkbox"/>
<label for="3"/>
<span for="3"> 3 AM- 4 AM </span>

I have tryed this but it's not working:

// or
// or
Actions builder = new Actions(driver);

Answer Source

If you are getting "Element is not currently visible and so may not be interacted with Command" exception, you are probably setting your element display or visibility property to hidden in one of your css classes. To fix it, do this.

JavascriptExecutor js = (JavascriptExecutor) driver;
js.executeScript("document.getElementById('3').setAttribute('display', 'block')");
js.executeScript("document.getElementById('3').setAttribute('visibility', 'visible')");
// Finally, click your checkbox.
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download