[英]Automatically Run a Script in my Browser console after opening a link using Python
I want to run some JavaScript in my browser DevTools console. 我想在浏览器DevTools控制台中运行一些JavaScript。 So far, I have opened up a specific website only through it.
到目前为止,我仅通过它打开了一个特定的网站。 Can it be done in Python?
可以用Python完成吗?
Right now, I am using the following code: 现在,我正在使用以下代码:
url = 'http://some-website.com/'
webbrowser.open(url)
What I want to do now is open up the DevTools console panel and then run a script through it automatically? 我现在想做的是打开DevTools控制台面板,然后自动通过它运行脚本? Can it be done by using Python or some other tool along with Python?
是否可以通过使用Python或其他工具以及Python来完成?
I don't belive this can be done, as 我不相信这可以做到,因为
ChromeDriver 2 and the DevTools windows both compete for the same automation channel, and ChromeDriver automatically closes the DevTools window in order for it to work.
ChromeDriver 2和DevTools窗口都争夺同一个自动化通道,ChromeDriver自动关闭DevTools窗口以使其正常工作。
See here for more: Chrome Developer Tools closes instantly when attempting to debug WebDriver E2E test 查看更多信息: 尝试调试WebDriver E2E测试时,Chrome开发者工具会立即关闭
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.