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.
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?
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...
Chrome provides extensions with many special-purpose APIs like chrome. runtime and chrome.
Chrome DevTools is a set of web developer tools built directly into the Google Chrome browser. These tools let you inspect the rendered HTML (DOM) and network activity of your pages. You can use DevTools to troubleshoot ad serving issues.
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
Just add the flag when opening Chrome and remote-debug it! :)
Chrome DevTools has two parts, front-end with UI and back-end in the native code of the renderer. These parts work with each other via protocol. The protocol is described in the protocol.js file
Chrome can work in remote debugging mode when it exposes tcp socket that can be used for interacting with the backend part of DevTools. This feature is actively used in Chrome browser Telemetry toolset
This toolset was written in python and we keep it in sync with the current version of the protocol. The toolset has the code for working with heap profiler part and other parts of the DevTools.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With