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...
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! :)