gpt4 book ai didi

python - `.select_by_visible_text()` 选择元素失败?

转载 作者:行者123 更新时间:2023-11-28 21:58:31 26 4
gpt4 key购买 nike

我不确定为什么 .select_by_visible_text() 无法选择元素?

以本站为例:https://www-01.ibm.com/products/hardware/configurator/americas/bhui/launchNI.wss

driver.get("https://www-01.ibm.com/products/hardware/configurator/americas/bhui/launchNI.wss")
driver.find_element_by_id("modelnumber").send_keys('7383AC1')
driver.find_element_by_name("submit").click()
FC='A1G7'
option_el=find_element_by_xpath("//option[contains(text(),'%s')]" %FC)
select_el=option_el.find_element_by_xpath("..")
Select(select_el).select_by_visible_text(FC)

enter image description here

最佳答案

driver.get("https://www-01.ibm.com/products/hardware/configurator/americas/bhui/launchNI.wss")
driver.find_element_by_id("modelnumber").send_keys('7383AC1')
driver.find_element_by_name("submit").click()
FC='A1G7'
option_el=find_element_by_xpath("//option[contains(text(),'%s')]" %FC)
option_el.click()

take click() instead of select

关于python - `.select_by_visible_text()` 选择元素失败?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18201399/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com