Issue
I am automating with selenium and reached a point where I click a drop down and there are 3 options and they are in a ul list, and each option is an li role. I am able to locate them and selenium can see them but selenium cannot click on them, it says it is not interactable.
Here is the code that is interacting with it.
browser.find_element(by=By.XPATH, value='//*[@id="ext4-ext-gen1136"]').click()
browser.find_element(by=By.CSS_SELECTOR, value='#boundlist-1078-listEl > ul > li:nth-child(3)').click()
(normally I use XPATH for everything but I figured I would try CSS Selector)
Here is the HTML code
<ul class="x4-list-plain"><li role="option" unselectable="on" class="x4-boundlist-item x4-boundlist-selected">Show Latest Event</li><li role="option" unselectable="on" class="x4-boundlist-item">Show All Events and Traces</li><li role="option" unselectable="on" class="x4-boundlist-item">Show All Events</li></ul>
<li role="option" unselectable="on" class="x4-boundlist-item x4-boundlist-selected">Show
Latest Event</li>
<li role="option" unselectable="on" class="x4-boundlist-item">Show All Events and
Traces</li>
<li role="option" unselectable="on" class="x4-boundlist-item">Show All Events</li>
I want to be able to select show all events and traces.
Solution
I figured it out, I had to have the drop down open to click on them but the dropdown would immediately close when selenium clicked on it, all I had to do was make selenium click on it twice and that fixed the issue.
Answered By - DDUffy
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.