0

I am able to click on the dropdown menu (which opens to display the menu items) using selenium.

I am trying to use selenium to then click on "CSV" but there are no identifiers in the html source that are unique to the CSV item, which makes using xpath difficult.

All of the menu items share the same names of everything. There is no "select" tag for them, either, which is why I can't use Select

Ideally, I'd want something like this: drive.find_element_by_xpath("//tag['something']").click()

If anyone has suggestions for other functions to use on the web driver that would be appreciated.

Here is the source:

<div class="ox-dropdown__menu " vertilize ngmouseleave="$ctrl.menuAim.mouseleaveMenu()">
<!--->
<ul class="ox-dropdown__body" ng-class="{'ox-dropdown__body--empty': $ctrl.isEmpty}">
<!--->
<li ng-class="{ disabled: data.isDisabled }" ng-repeat="choice in $ctrl.options" data="choice" tier ng-click="!choice.isDisabled && $ctrl.optionsOnClick(choice)" on-mouseenter="$ctrl.menuAim.mouseenterRow" row-id="$index" >...</li> 
<!--->
<li ng-class="{ disabled: data.isDisabled }" ng-repeat="choice in $ctrl.options" data="choice" tier ng-click="!choice.isDisabled && $ctrl.optionsOnClick(choice)" on-mouseenter="$ctrl.menuAim.mouseenterRow" row-id="$index">
<!--->
<!--->

<a ng-click="!data.isDisabled && data.onClick($event)" ng-if="!data.link" >...</a> this line is what is highlighted when "CSV" is right-clicked with "inspect element"

<span ng-if="data.name"> CSV</span>

this line is directly under the a tag above

Sarah
  • 3
  • 4
  • If you can select the dropdown, you may be able to use **item.select_by_value('1')** where 1 is the position of your desired listitem. – blacktj Jul 12 '19 at 18:46
  • @blacktj I was able to use dropdown.find_by_class_name('classname').click() to find and click on the dropdown. I can't use select or select_by_value() bc there are no select tags right? – Sarah Jul 12 '19 at 20:09
  • When I had this issue.. I was able to get into it using that method: `from selenium import webdriver from selenium.webdriver.support.ui import Select driver = webdriver.Firefox() driver.get('url') select = Select(driver.find_element_by_id('fruits01')) # select by value select.select_by_value('1')` [link](https://stackoverflow.com/questions/7867537/how-to-select-a-drop-down-menu-option-value-with-selenium-python) – blacktj Jul 12 '19 at 20:15

0 Answers0