selenium
selenium copied to clipboard
[🚀 Feature]: .har file export support for Chrome DevTools request/response objects
Feature and motivation
I've just started using Selenium 4's Chrome DevTools integration and it's amazingly powerful. I found myself using it to capture request/response data while running a test, to be able to look through what happened API call-wise when a test fails.
However I don't see a clean way to export the request/response objects to a standardized file format, like that of .har file for easier consumption after.
I think adding in this feature would make the lives of people utilizing the request/response caps of Selenium 4 a whole lot easier, i.e. download the .har file from the test run, open it in a .har viewer or chrome dev tools, and very quickly inspect what went wrong, in a format they're used to viewing in general.
Usage example
As mentioned before, I can see testers keeping logs of requests/responses that happen during a test run, and if the test fails, logging that information as more detail to check why a test had failed. At the moment this would be either logging out specific parts of the request/response objects to a log file or worse to cli.
Adding in a way to easily write a list of request/response objects (or a way to capture all network traffic and do this export) would save testers time since they would not need to go re-run the test again and watch the network tab in their browser, or even worse try to replicate it by hand. And as we know some API call failures are super rare and difficult to replicate again later on.
@Proryanator, thank you for creating this issue. We will troubleshoot it as soon as we can.
Info for maintainers
Triage this issue by using labels.
If information is missing, add a helpful comment and then I-issue-template label.
If the issue is a question, add the I-question label.
If the issue is valid but there is no time to troubleshoot it, consider adding the help wanted label.
If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, W3C),
add the applicable G-* label, and it will provide the correct link and auto-close the
issue.
After troubleshooting the issue, please add the R-awaiting answer label.
Thank you!
It would be really good if the data returned was already in the correct format and then we just write the returned serialisation down to disk.
That would be good ye 👍
Yes. We are eagerly waiting for such HAR file export feature and it would be very useful, when we get the complete support of capturing and downloading the network traffic in the form of .har file of a webpage using chrome devtools in Selenium 4 in c# with Remote web driver.
We have been discussing this in the team, and whereas Selenium now enables direct communication with DevTools, this specific type of feature will not be implemented directly in Selenium. We are now getting close to other projects built on top of Selenium and they will most likely pick this and offer the feature. For example, in Java, Selenide has this in their roadmap.
If you need advice on which frameworks are available, feel free to join us in our chat and we can help to find the right one for you. https://www.selenium.dev/support/
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.