Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/342.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列表顺序发送键_Python_List_Webdriver - Fatal编程技术网

Python列表顺序发送键

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

您好,我怎样才能按顺序从列表中选择元素,因为我需要使用webdriver发送密钥 driver.find_元素\u by_xpath.send_keys()

比如说

x=[1,2,3,4,5,6]

我需要在循环中设置它,而不逐个调用元素


我需要从我的列表中选择第一个元素,然后是第二个,然后是第三个

您正在谈论的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')