简体   繁体   中英

python3 How do I click dropdown box using selenium

I'm trying to click on dropbox using selenium on python3. 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. 在此处输入图片说明

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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