Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/338.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/selenium/4.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/arrays/13.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 - Fatal编程技术网

Python 如何使用selenium从列表中选择项目?

Python 如何使用selenium从列表中选择项目?,python,selenium,Python,Selenium,使用selenium从列表中选择时出现问题 我试过那个密码 进口硒 从selenium导入webdriver driver=webdriver.Chrome 司机,上车https://www.asiamiles.com/en/enrolment.html' 标题 title\u list=驱动程序。通过\u id'react-select-2-value'查找\u元素 标题列表。发送密钥'Mr' 错误消息是找不到该项目!! selenium.common.exceptions.ElementNo

使用selenium从列表中选择时出现问题

我试过那个密码

进口硒 从selenium导入webdriver driver=webdriver.Chrome 司机,上车https://www.asiamiles.com/en/enrolment.html' 标题 title\u list=驱动程序。通过\u id'react-select-2-value'查找\u元素 标题列表。发送密钥'Mr' 错误消息是找不到该项目!! selenium.common.exceptions.ElementNotInteractiableException:消息:元素不可交互


我怎么能修好它

您无法向该列表发送密钥,请尝试使用

import selenium
from selenium import webdriver

driver = webdriver.Chrome()
driver.get('https://www.asiamiles.com/en/enrolment.html')
#title
title_list = driver.find_element_by_id('react-select-2--value')
title_list.click()
driver.find_element_by_xpath('//*[contains(text(), "Mr")]').click()
您可能需要使用driver.find_elements_by_id。这将返回一个列表,然后可以对其进行筛选