python3如何使用selenium单击下拉框

时间:2016-09-30 08:11:56

标签: python selenium

我正在尝试使用python3上的selenium点击dropbox。 但是我收到了错误信息。

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

我的代码如下。

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

和..代码是...... 我想点击“排序依据”,但我不能。 enter image description here

1 个答案:

答案 0 :(得分:0)

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