我想通过使用python和selenium自动化来选择一个特定的选项。我可以按名称选择文本字段,但不确定如何选择窗体中的下拉列表
https://docs.google.com/forms/d/e/1FAIpQLScbs4_3hPNYgjUO-hIa-H1OfJiDZ-FIY1WSk31jGyW5UtQ-Ow/viewform
我曾经尝试过使用send\u键按类获取元素,但似乎不起作用
driver.find_element_by_class_name("quantumWizMenuPaperselectOption freebirdThemedSelectOptionDarkerDisabled exportOption").send_keys("my choice")
如何从上表的下拉列表中选择一个选项
要选择文本为选项2的选项,必须为
element_to_be_clickable()
引入WebDriverWait,并且可以使用以下Locator Strategies:使用
CSS_SELECTOR
:使用
XPATH
:注意:必须添加以下导入:
看起来这个类返回了多个元素
上面返回它找到的第一个碰巧不起作用的。另一个策略是“尝试,但点击”所有这些。见下文
相关问题 更多 >
编程相关推荐