Python列表顺序发送键
您好,我怎样才能按顺序从列表中选择元素,因为我需要使用webdriver发送密钥 driver.find_元素\u by_xpath.send_keys() 比如说 x=[1,2,3,4,5,6] 我需要在循环中设置它,而不逐个调用元素Python列表顺序发送键,python,list,webdriver,Python,List,Webdriver,您好,我怎样才能按顺序从列表中选择元素,因为我需要使用webdriver发送密钥 driver.find_元素\u by_xpath.send_keys() 比如说 x=[1,2,3,4,5,6] 我需要在循环中设置它,而不逐个调用元素 我需要从我的列表中选择第一个元素,然后是第二个,然后是第三个您正在谈论的selenium automation,这不起作用。请检查我的编辑,我已经解释了我要创建的循环 from selenium.webdriver.support.ui import Selec
我需要从我的列表中选择第一个元素,然后是第二个,然后是第三个您正在谈论的selenium automation,这不起作用。请检查我的编辑,我已经解释了我要创建的循环
from selenium.webdriver.support.ui import Select
element= Select(driver.find_element_by_xpath('xpath_of_element'))
#Using the index of dropdown
element.select_by_index(1)
# Using the value of dropdown
element.select_by_value('1')
Yo#u can use match the text which is displayed in the drop down.
element.select_by_visible_text('Banana')
from selenium.webdriver.support.ui import Select
element= Select(driver.find_element_by_xpath('xpath_of_element'))
#Using the index of dropdown
element.select_by_index(1)
# Using the value of dropdown
element.select_by_value('1')
Yo#u can use match the text which is displayed in the drop down.
element.select_by_visible_text('Banana')