Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/321.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Selenium从下拉菜单中选择选项,即使在获取所有标签时也是如此_Python_Selenium_Selenium Webdriver - Fatal编程技术网

Python Selenium从下拉菜单中选择选项,即使在获取所有标签时也是如此

Python Selenium从下拉菜单中选择选项,即使在获取所有标签时也是如此,python,selenium,selenium-webdriver,Python,Selenium,Selenium Webdriver,我试图从中选择鞋的尺寸。 我尝试了几乎所有的方法,如选择、按索引选择、按值选择等,但出现以下错误- selenium.common.exceptions.ElementNotInteractableException: Message: Element <option> could not be scrolled into view 选择元素已禁用您需要处理无序列表下拉列表: driver.find_element_by_link_text("Select Size").click

我试图从中选择鞋的尺寸。 我尝试了几乎所有的方法,如选择、按索引选择、按值选择等,但出现以下错误-

selenium.common.exceptions.ElementNotInteractableException: Message:
Element <option> could not be scrolled into view

选择元素已禁用您需要处理无序列表下拉列表:

driver.find_element_by_link_text("Select Size").click()
driver.find_element_by_xpath("//li[.='UK 6']").click()
如果要按索引选择选项:

driver.find_elements_by_xpath("//ul[@class='product-size-select-list']/li")[1].click()

可能重复的否,我得到所有的标签,但无法选择或点击下拉itms(就像我想选择英国7的大小)
driver.find_elements_by_xpath("//ul[@class='product-size-select-list']/li")[1].click()