我在搜索元素
中键入输入时遇到元素未找到错误
我使用的代码:
browser.find_element_by_css_selector("input[id='pubicationQuery'][name='publicationQuery']").click()
浏览器是我的webDriver selenium对象。
我已尝试过类名,也是X
路径但无法找到该元素。
错误:
selenium.common.exceptions.NoSuchElementException: Message: Unable to locate element: input[id='pubicationQuery'][name='publicationQuery']
答案 0 :(得分:3)
从错误和你添加的图片中我可以理解,这只是一个错字
在下面的代码中,id应该是publicationQuery而不是pubicationQuery。
编辑 - 忘记解决错误
browser.find_element_by_css_selector("input[id='publicationQuery'][name='publicationQuery']").click()