我正在尝试废弃一个网站的下拉类别的所有组合。但是,选项的文本属性仅为空白。尽管在检查时,我可以看到每个选项都存在文本。
from selenium import webdriver
from selenium.webdriver.support.ui import Select
driver = webdriver.Chrome()
driver.get('https://www.fiyo.nl/')
driver.find_element_by_xpath('//*[@id="select_device_chosen"]/a').click()
select = Select(driver.find_element_by_xpath('//*[@id="select-device"]'))
print ([o.text for o in select.options])
Output:
['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '']
如果我收到文本,我想循环遍历所有值以获得其他下拉列表的不同组合。