【发布时间】:2019-11-19 17:33:01
【问题描述】:
为了调查某些 Selenium 测试失败,我想在运行测试时自动启用 pause on exception feature in the Chrome Devtools。
有 --auto-open-devtools-for-tabs 命令行选项用于自动打开我已经在使用的 DevTools 窗格,但显然我正在寻找的自动暂停功能没有 CLI 选项/参数。
我遇到的是 Debugger.setPauseOnExceptions Chrome Devtools Protocol command,我尝试使用 execute_cdp_cmd 激活它(我正在使用 Selenium for Python):
driver.execute_cdp_cmd("Debugger.setPauseOnExceptions", {"state": "all"})
不幸的是,即使选项卡处于打开状态(包括 DevTools 窗格),我也得到了
unhandled inspector error: {"code":-32000,"message":"Debugger agent is not enabled"}
我做错了什么还是有其他方法(最好是可靠且可移植的方法,请不要使用宏)?
【问题讨论】:
标签: python selenium selenium-webdriver selenium-chromedriver google-chrome-devtools