[英]Python/Selenium not switching pages for Chrome 78 when executing Javascript
我有一个脚本可以切换包含表格的网站页面。 它已经运行了几个月(上次使用 Chrome 版本 76),但在安装新的 Chrome 版本 78.0.3904.70 后,出现了错误:
driver.execute_script("__doPostBack('action','Page${}')".format(page))
File "C:\ProgramData\Anaconda3\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 636, in execute_script
'args': converted_args})['value']
File "C:\ProgramData\Anaconda3\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "C:\ProgramData\Anaconda3\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
JavascriptException: javascript error: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them
(Session info: chrome=78.0.3904.70)
我使用命令driver.execute_script("__doPostBack('action','Page${}')".format(page))
来切换页面。 我已经使用“价值”搜索并尝试了解决方案,但没有任何效果。
我搜索了消息块'args': converted_args})['value']
和
JavascriptException: javascript error: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them
(Session info: chrome=78.0.3904.70)
但没有一个是有帮助的。
我的 Python 版本是 3.6,Chromedriver 版本是 78.0.3904.70。 Windows 10 x64
实际上,这样的事情可能会起作用:
el = driver.execute_script("""
return document.querySelector('[onclick*="Page${}"]')
"""
el.click()
尝试更新您的 selenium 依赖项,您可能正在使用导致问题的 selenium 的旧依赖项
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.