S
S
Sacred702019-05-25 05:43:25
Python
Sacred70, 2019-05-25 05:43:25

How to find dropdown menu item through Selenium Python?

Good afternoon. There is an element on the site that, when clicked, brings up a menu. Tell me how to find the sixth element of the dropdown menu through Selenium? I also tried using xpath and names and classes, but the maximum that was possible was to press the button to drop the menu. I post a screenshot of the site code tree 5ce8ab65e8d7d878847591.jpeg
and xpath: /html/body/div1/div/div/div/aside/div/div/div/div[2]/div/div/ui-scroll/div/div/div/ul/ li[6]

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Michael, 2019-05-25
@Sacred70

driver.find_elements_by_xpath("//li[@class='item ng-scope selected']")

Therefore, in the cycle you have to go through all (as I understand it, there are more than one of them), and you are already applying a new search filter to each element.
Or cling to by_xpath("//li[@ng-if='vm.isBinary()']")
up: I didn't notice that this is the 6th element, then it's even easier, you just have to take the sixth one for all li, profit.
ps throw off the page, I'll try to do it myself :3

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question