How can we automate developer tools particularly the networks section using Selenium?
I need the preview section data of a service call to be logged while using automation.
- Is it possible?
- If so, how do I achieve this?
Selenium 4 alpha version introduces an Interface for Chrome DevTools API. I'm unable to find anything official (still in alpha) but here are some example uses:
http://executeautomation.com/blog/selenium-4-understanding-and-working-with-chromium-dev-tools/
https://testersdigest.blogspot.com/2019/10/selenium-4-chrome-devtools-api.html
No, not with Selenium. Selenium only works on the website part of the browser, not the browser user interface itself.
In your case you want to retrieve the output from a HTTP call, which can be done with Selenium, although I would want to test the user behavior with Selenium. While using API testing tools like Postman for validating return values from HTTP calls.
I think you miss some foundational understanding of how websites do HTTP calls. I suggest you do some research into how websites work, how the access HTTP API's and how the return values are handled.
Automating Chrome Dev Tools:
I think you can access most of its features through the devtools protocol: https://chromedevtools.github.io/devtools-protocol/
Maybe you can ask a new question, about what you want to achieve, maybe we know alternatives that do not use the Chrome developer tools.
If you really want to interact with the developer tools automated have a look at Sikuli or maybe Winium and AutoIt.
See Powerful Automation with the Chrome DevTools Protocol. This shows using Javascript and the Chrome DevTools Protocol today with Puppeteer.