<div class="dropdown"> <a class="no-disable dropdown-toggle" data-toggle="dropdown"> <span class="glyphicon glyphicon-list"></span> <br> <span class="add-item-text text-uppercase">Batch Management</span> </a> <ul class="dropdown-menu text-uppercase"> <li> <a href="http://sqa.stackexchange.com/website/administration/foo" class="full-width text-uppercase" style="padding:4px 0px;">Foo</a> </li> <li> <a href="http://sqa.stackexchange.com/website/administration/foo2" class="full-width text-uppercase" style="padding:4px 0px;">Foo 2</a> </li> <li> <a href="http://sqa.stackexchange.com/website/administration/foo3" class="full-width text-uppercase" style="padding:4px 0px;">Foo 3</a> </li> </ul> </div>
The exception I am getting is an ElementNotInteractableException for the next element (the item in the list) which leads me to believe that Selenium is clicking on the dropdown menu (because it is clickable), however, it is not ready to actually dropdown the menu, and then when it tries to click the member of the dropdown it fails because the menu never actually opened.
I have tried clicking the anchor element and both the span elements, and none of them reliably open the dropdown. I have tried waiting for the element to be clickable for all of these solutions, as well, and none reliably work. The only way I can get it to open the dropdown is by using Thread.sleep() which I would prefer to avoid. So, if anyone has any ideas for what explicit wait I need to use here, I am all ears.
Edit 2: I also thought it would be useful for you guys to see Bootstrap’s documentation. So here it is
Source link https://sqa.stackexchange.com/questions/33723/how-to-reliably-click-bootstrap-dropdown-with-no-button-element