我已经在PyCharm-CE中使用Python的Selenium绑定三年了,它的函数从来没有出现过任何问题
但现在我在尝试使用find_element_by_link_text时遇到了一个非常奇怪的错误,如中所示
browser.find_element_by_link_text("Administration").click()
错误如下所示:
selenium.common.exceptions.JavascriptException: Message: javascript error: this.each is not a function
其他find_element_by函数工作得非常好
在将我的所有软件包(包括selenium
)更新为4.0之后,除了上述警告之外,我还收到了以下警告:
UserWarning: find_element_by_* commands are deprecated. Please use find_element() instead
warnings.warn("find_element_by_* commands are deprecated. Please use find_element() instead")
我再次将selenium
降级为3.141.0,但随后我再次收到this.each
错误,没有任何警告
我还尝试了selenium.dev提供的其他不同方法,例如
browser.find_element(By.LINK_TEXT, value="Administration")
但它们似乎也不起作用
发生了什么变化?我必须改变什么?为什么所有其他类似的find\u元素函数,比如id/xpath/visible\u text/等都能工作?我束手无策,我不想重写我所有的find\u element\u by\u link\u文本调用:(
该函数最终与Chrome83 Beta和Chromedriver 83配合使用,看起来问题是由Chromedriver的旧版本引起的,该版本错误地调用了prototype.js
83版的修补程序说明:
“更新了Chromedriver以正确使用prototype.js。”
相关问题 更多 >
编程相关推荐