Chrome开发者工具API和Selenium WebDriver [英] Chrome Dev Tools API & Selenium WebDriver
问题描述
我正在尝试使用 Selenium Web Driver 来实现浏览器集成测试的自动化.我看到 Chrome开发工具随附了
I am experimenting with Selenium Web Driver for automating my browser integration tests. I see that Chrome Dev Tools comes with a console API for invoking certain dev tool functions from inside JavaScript.
理想情况下,从Java/JUnit集成测试内部,我可以启动Chrome Dev Tool内存分析器(可能还有其他一些工具),运行WebDriver测试(实例化Chrome浏览器实例,操纵DOM元素等),然后停止分析器,然后检查分析器的结果以查看是否存在内存泄漏.
Ideally, from inside my Java/JUnit integration test, I could start the Chrome Dev Tool memory profiler (and perhaps some other tools), run my WebDriver tests (instantiating a Chrome browser instance, manipulating DOM elements, etc.), and then stop the profiler, then inspect the profiler's results to see if there are any memory leaks.
这个概念甚至可行还是我要出去吃午饭?为什么/为什么不呢?
Is this concept even feasible or am I way out to lunch? Why/why not?
该API似乎已经具有一个console.profile()
来启动性能分析会话,以及一个console.profileEnd()
.因此从理论上讲,我可以让WebDriver调用这两种方法并在它们之间运行测试.
It seems like the API already has a console.profile()
to start a profiling session, and a console.profileEnd()
. So in theory I could have WebDriver invoke these two methods and run tests in between them.
我认为缺少的链接随后将以编程方式与性能分析会话的结果进行交互...
I think the missing link is then programmatically interacting with the results of the profiling session...
推荐答案
您实际上可以使用上面@loislo提到的调试器协议–您可能会发现链接
You can actually use the debugger protocol as mentioned by @loislo above – you might find more useful the link https://developer.chrome.com/devtools/docs/debugger-protocol
打开Chrome并对其进行远程调试时,只需添加该标志即可! :)
Just add the flag when opening Chrome and remote-debug it! :)
这篇关于Chrome开发者工具API和Selenium WebDriver的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!