Scrapy,Selenium,jQuery Dropdown与具有style =“ display:none;的select标签的行为不一致:];

问题描述 投票:0回答:1

我正在尝试在此页面上设置下拉列表:https://willmyphonework.net/AdvanceLookup

第一个下拉列表和第四个下拉列表非常相似(品牌和国家/地区)。这是我用来获取品牌(oem)和国家/地区的代码:

oem = Select(wd.find_element_by_css_selector("#alBrandsList"))
oem.select_by_visible_text("Acer")

countries = Select(wd.find_element_by_css_selector("#alCountriesList"))
countries.select_by_visible_text("Albania")

该下拉菜单在技术上是隐藏的,但它似乎在某种程度上适用于设备/ OEM下拉菜单。对于国家/地区下拉列表,它是说内容不可见(不是)。这是从中提取的HTML代码:

<select class="pretty-dropdown" datatosent="brand" id="alBrandsList" name="alBrandsList" selectorid="alPhoneModelsList" target="/AdvanceLookup/GetPhoneModels/" style="display: none;">
  ...
</select>
<button type="button" class="ui-multiselect ui-widget ui-state-default ui-corner-all" aria-haspopup="true" style="width: 232px;">
  <span class="ui-icon ui-icon-triangle-2-n-s"></span>
  <span>Please select brand(s)</span>
</button>

<select class="pretty-dropdown" datatosent="country" id="alCountriesList" name="alCountriesList" selectorid="alCarriersList" target="/AdvanceLookup/GetCarriers/" style="display: none;">
  ...
</select>
<button type="button" class="ui-multiselect ui-widget ui-state-default ui-corner-all" aria-haspopup="true" style="width: 232px;">
  <span class="ui-icon ui-icon-triangle-2-n-s"></span>
  <span>Please select country</span>
</button>

任何想法为什么它都适用于第一个而不是第二个?

我正在尝试在此页面上设置下拉列表:https://willmyphonework.net/AdvanceLookup第一个下拉列表和第四个下拉列表非常相似(品牌和国家/地区)。这是我用于...

python selenium xpath webdriverwait xpath-1.0
1个回答
0
投票

由于页面<select>上第一个和第四个下拉列表的https://willmyphonework.net/AdvanceLookup标签都具有属性[[style="display: none;

© www.soinside.com 2019 - 2024. All rights reserved.