[英]Drop down is hidden, Not sure how to handle it using selenium python?
所以下拉值在 select 标记以及行标记中可用。我提供了下面的代码截图。 select 标签 html和li 标签 html或者如果您可以通过以下步骤看到下降
正如@Peres995 所指出的,您确实可以用文本填充该字段,您只需要 select 输入字段。
尝试:
country = 'Brazil'
_id = 'countryDropdown-account_titleText'
identifier = "//input[@id='{}']".format(_id)
# Make sure it's not invisible
driver.execute_script("document.getElementById('{}').setAttribute('style','display: initial;')".format(_id), identifier)
# Clear the field
driver.find_element_by_xpath(identifier).clear()
driver.find_element_by_xpath(identifier).send_keys('{country}'.format(country=country))
您可以使用文本填充该字段作为正常输入。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.