Python webdriver.support.select-选择不';t与元素交互

Python webdriver.support.select-选择不';t与元素交互,python,select,drop-down-menu,selenium-webdriver,Python,Select,Drop Down Menu,Selenium Webdriver,你好, 我有以下选择: <div class="col-xs-12 col-md-6"> <label class="ph_label pointer city"> <span class="l citylbl">City</span> <select class="cities custom-dropdown" data-validation-error-msg="You must select a city" required="" n

你好, 我有以下选择:

<div class="col-xs-12 col-md-6">
<label class="ph_label pointer city">
<span class="l citylbl">City</span>
<select class="cities custom-dropdown" data-validation-error-msg="You  must select a city" required="" name="city" disabled="disabled" data-validation="required">
<option value="">City</option>
<option value="Shanghai">Shanghai</option>
<option value="Beijing">Beijing</option>
<ul class="cities custom-dropdown" data-target-selector="select.cities" style="width: 293px;">
</label>
</div>
mySelect = Select(self.driver.find_element_by_name("city"))
mySelect.select_by_value("Shanghai")
当我看到测试运行时,selenium通过了这个元素,好像一切都正常,但事实上城市没有被选中。
有什么想法吗?

我想这是因为代码段中的select被标记为已禁用


我尝试过使用Watir webdriver,如果有
disabled=“disabled”
属性,我会得到您描述的行为。一旦我删除它,我想要的值就会被选中。

任何其他带有
name=“city”
的元素?只有一个元素具有此名称!您是否尝试用
其他定位器
而不是名称来识别select?似乎可以使用
name=“city”
yes使用其他元素,如xpath、css等。感谢回复@chefsim。使用
dropdown\u city=self.driver。按名称(“city”)self.driver查找元素。执行脚本(“参数[0]。删除属性(“禁用”);”,dropdown\u city)