简体   繁体   English

python3如何使用硒单击下拉框

[英]python3 How do I click dropdown box using selenium

I'm trying to click on dropbox using selenium on python3. 我正在尝试在python3上使用硒单击Dropbox。 but I got an error msg. 但我收到一个错误消息。

 raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoSuchWindowException: Message: Unable to find element on closed window

My code is below. 我的代码如下。

driver.find_element_by_css_selector("#RegularCategory>div.pagination dl.dropdown dt a span").click()

and..code is ... I want to click on "sort by" but I can't. and..code是...我想单击“排序依据”,但我不能。 在此处输入图片说明

您可以使用硒的select类及其API,例如select_by_index或select_by_value:参考: [http://selenium-python.readthedocs.io/api.html]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM