我有一个脚本可以切换包含表的站点页面。它已经运行了好几个月(最近一次使用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
答案 0 :(得分:1)
实际上,类似的方法可能有效:
el = driver.execute_script("""
return document.querySelector('[onclick*="Page${}"]')
"""
el.click()