I am using Selenium to try and select an element in a bootstrap dropdown menu, but there is no button element present. The website uses all JavaScript to enable the dropdown. The HTML code for the Bootstrap dropdown is shown below.
<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="/website/administration/foo" class="full-width text-uppercase" style="padding:4px 0px;">Foo</a>
</li>
<li>
<a href="/website/administration/foo2" class="full-width text-uppercase" style="padding:4px 0px;">Foo 2</a>
</li>
<li>
<a href="/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.
Note: I can post the JavaScript files, but they are horribly organized (zero line breaks anywhere), so I won't include them right now, but if anyone wants to try and sift through them, I can post them. I am not that familiar with JavaScript, so I don't even know if they are that relevant to the problem
Edit: After some further research, it looks like there are some jQuery events that trigger after certain events. If I could use selenium to trigger these events, I think that would work, but I am even less familiar with jQuery than just Javascript. The relevant events are posted below
Edit 2: I also thought it would be useful for you guys to see Bootstrap's documentation. So here it is