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.ElementNotInteractiableException:消息:元素不可交互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
我怎么能修好它 您无法向该列表发送密钥,请尝试使用
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。这将返回一个列表,然后可以对其进行筛选