Having difficulty selecting an item from a Javascript dropdown, where the items are not visible in the DOM tree until a link is clicked. Attempted to use the Actions class with code like this:
Actions cursor = new Actions(driver);
cursor.moveToElement(linkThatDropsMenu).perform();
cursor.click();
Tried using clickAndWait() function which seems to be missing from Java WebDriver libraries, and experimented with pausing and clicking variations including double clicking. Even tried clickAndHold() without success.
Upon generation of the menu, changes can be seen in the DOM tree with the insertion of div class="menu"
<div id="divIdActive_2" class="data number active" style="min-height: 21px;">
<a class="opencnl" href="#">
<span id="opencnlSpan" class="active" style="background-color:
transparent;">800-852-2222</span>
</a>
<img class="tollFree" title="Display name(s) for Toll free function properly on
Verizon Wireless devices, but may be omitted by other carriers on
their devices." src="img/nil.gif">
<input id="customNum" type="hidden" value="8008522222" name="number_2">
<div class="menu">
<a class="edit" href="#">Change Custom Number</a>
<a class="copy" href="#">Copy Settings for 0 Selected Lines</a>
<a class="clear" href="#">Clear Settings For this Line</a>
</div>
</div>
Interestingly, able to trigger the menu drop from the IDE using click() or clickAndWait() with the same locator. In my Java code, locators retrieve the element's text but fail to perform a click action. Other click commands work perfectly in the Java code, except for this particular case. Any thoughts or suggestions? Appreciate your time!