HAR (HTTP Archive) data is not being generated correctly.
💥 Regression Report
In selenium-side-runner 4.0.8, when capturing the HTTP Archive (HAR) data, the output appears to be incorrect. The data does not reflect the expected structure and content, resulting in incomplete or malformed HAR files. It used to work fine in 3.17.0. I am using the API devtools.network.getHAR() to capture the HAR from my Chrome plugin. I am dumping the HAR data during the onLoad and onClick events.
I wondered why there is a regression in Chrome API in the latest selenium-side-runner version.
Attached complete HAR files for reference.
Selv4.0.8_HAR.txt Selv3.17.0_HAR.txt
Below are the notable differences I found in the HAR data.
Sample output of HAR captured in 4.0.8:
{ "version": "1.2", "creator": { "name": "WebInspector", "version": "537.36" }, "pages": [], "entries": [ {
Sample output of HAR captured in 3.17.0
{"log":{ "version": "1.2", "creator": { "name": "WebInspector", "version": "537.36" }, "pages": [ { "startedDateTime": "2024-05-23T12:25:18.448Z", "id": "page_1", "title": "https://opensource-demo.orangehrmlive.com/web/index.php/auth/login", "pageTimings": { "onContentLoad": 6203.97699996829, "onLoad": 6204.739999957383 } } ], "entries": [ {
The difference is that 'pages' object is empty in the 4.0.8 version. Also, the number of entries in the 4.0.8 HAR file is lesser when compared with the 3.17.0 HAR file.
Last working version
Worked up to version: 3.17.0
Stopped working in version: 4.0.8
To Reproduce
Steps to reproduce the behavior: To dump the HAR data using the API devtools.network.getHAR(). Sample code to dump HAR data as part of the Chrome plugin.
Expected behavior
After invoking the HAR API proper HAR data should be generated as per the standard.
Project file reproducing this issue (highly encouraged)
Please provide a project file .side that reproduces this issue.
{
"id": "ac4bb5e3-0ac8-4890-831e-a33062e445d8",
"version": "2.0",
"name": "Orange",
"url": "https://opensource-demo.orangehrmlive.com",
"tests": [{
"id": "0208b7e5-acf9-49ae-849e-6a11c634db7b",
"name": "t1",
"commands": [{
"id": "186c1f41-3d9b-4767-93b9-1acbc9633270",
"comment": "",
"command": "open",
"target": "/web/index.php/auth/login",
"targets": [],
"value": ""
}, {
"id": "04484fb3-ecdc-49e9-a97a-f42ff5a45349",
"comment": "",
"command": "setWindowSize",
"target": "1400x970",
"targets": [],
"value": ""
}, {
"id": "4e787659-7f44-4bf7-8e78-0d69dadca301",
"comment": "",
"command": "type",
"target": "name=username",
"targets": [
["name=username", "name"],
["css=.oxd-input--focus", "css:finder"],
["xpath=//input[@name='username']", "xpath:attributes"],
["xpath=//div[@id='app']/div/div/div/div/div[2]/div[2]/form/div/div/div[2]/input", "xpath:idRelative"],
["xpath=//div[2]/input", "xpath:position"]
],
"value": "Admin"
}, {
"id": "72e65992-5f57-461f-b133-5aa87a83ae2f",
"comment": "",
"command": "click",
"target": "name=password",
"targets": [
["name=password", "name"],
["css=.oxd-input--focus", "css:finder"],
["xpath=//input[@name='password']", "xpath:attributes"],
["xpath=//div[@id='app']/div/div/div/div/div[2]/div[2]/form/div[2]/div/div[2]/input", "xpath:idRelative"],
["xpath=//div[2]/div/div[2]/input", "xpath:position"]
],
"value": ""
}, {
"id": "686e15db-0fbf-43b7-a98c-9ac0c9f70382",
"comment": "",
"command": "type",
"target": "name=password",
"targets": [
["name=password", "name"],
["css=.oxd-input--focus", "css:finder"],
["xpath=//input[@name='password']", "xpath:attributes"],
["xpath=//div[@id='app']/div/div/div/div/div[2]/div[2]/form/div[2]/div/div[2]/input", "xpath:idRelative"],
["xpath=//div[2]/div/div[2]/input", "xpath:position"]
],
"value": "admin123"
}, {
"id": "991f9370-d21c-4d2b-a266-f7a65584f71e",
"comment": "",
"command": "click",
"target": "css=.oxd-button",
"targets": [
["css=.oxd-button", "css:finder"],
["xpath=//button[@type='submit']", "xpath:attributes"],
["xpath=//div[@id='app']/div/div/div/div/div[2]/div[2]/form/div[3]/button", "xpath:idRelative"],
["xpath=//button", "xpath:position"],
["xpath=//button[contains(.,'Login')]", "xpath:innerText"]
],
"value": ""
}, {
"id": "1860fbb8-37bb-4c91-8330-636e50b9da7c",
"comment": "",
"command": "click",
"target": "css=.oxd-main-menu-item-wrapper:nth-child(1) .oxd-text",
"targets": [
["css=.oxd-main-menu-item-wrapper:nth-child(1) .oxd-text", "css:finder"],
["xpath=//div[@id='app']/div/div/aside/nav/div[2]/ul/li/a/span", "xpath:idRelative"],
["xpath=//span", "xpath:position"],
["xpath=//span[contains(.,'Admin')]", "xpath:innerText"]
],
"value": ""
}, {
"id": "58b7f7c6-2ef5-439f-91aa-fd1b4cec8e12",
"comment": "",
"command": "click",
"target": "css=.oxd-userdropdown-icon",
"targets": [
["css=.oxd-userdropdown-icon", "css:finder"],
["xpath=//div[@id='app']/div/div/header/div/div[2]/ul/li/span/i", "xpath:idRelative"],
["xpath=//span/i", "xpath:position"]
],
"value": ""
}, {
"id": "80a16b72-1410-40c6-84dd-c3c3bcee9d46",
"comment": "",
"command": "pause",
"target": "3000",
"targets": [],
"value": ""
}, {
"id": "bb10784c-f494-4a6c-b076-d6d76b5d0190",
"comment": "",
"command": "click",
"target": "linkText=Logout",
"targets": [
["linkText=Logout", "linkText"],
["css=li:nth-child(4) > .oxd-userdropdown-link", "css:finder"],
["xpath=//a[contains(text(),'Logout')]", "xpath:link"],
["xpath=//div[@id='app']/div/div/header/div/div[2]/ul/li/ul/li[4]/a", "xpath:idRelative"],
["xpath=//a[contains(@href, '/web/index.php/auth/logout')]", "xpath:href"],
["xpath=//li/ul/li[4]/a", "xpath:position"],
["xpath=//a[contains(.,'Logout')]", "xpath:innerText"]
],
"value": ""
}]
}],
"suites": [{
"id": "76a9ba22-37a6-4aec-ae9d-fa685bb66b4f",
"name": "Default Suite",
"persistSession": false,
"parallel": false,
"timeout": 300,
"tests": ["0208b7e5-acf9-49ae-849e-6a11c634db7b"]
}],
"urls": ["https://opensource-demo.orangehrmlive.com/"],
"plugins": []
}
Issues without a reproduction project are likely to stall.
Environment
OS: Linux 7 Selenium IDE Version: 3.17.0 Selenium SIDE Runner Version: 4.0.8 Please note that selenium-side-runner supports Node.js 8 - 10
Node version: v16.13.1 Only required if using selenium-side-runner
Browser: Google Chrome Browser Version: 120.0.6099.224 ChromeDriver 120.0.6099.109
Hi @toddtarsi
Verified this in the latest Google Chrome Browse and Chromedriver but the same issue exists. Google Chrome 125.0.6422.112 ChromeDriver 125.0.6422.78
This is a regression to the previous version 3.17. Can you please check.
Thanks, fmrahman.
@fmrahman - Thank you for your patience, I've been taking a bit of personal space for the last couple weeks. I'll start looking into this again this week.
@fmrahman - I'm back now and trying to do an hour or less nightly of oss. I'll be looking at this in the next couple nights.
Hi @toddtarsi Hope you are working on this. Can you please provide a fix for this issue. Since this is a regression we are unable to release updates to our product with the new selenium-side-runner v4.0.8. We are stuck with this issue.
Hi @toddtarsi
Can you please provide the fix for this.
Thanks, fmrahman.
@fmrahman - Okay, I think there is a reason I'm so useless here. I'm crap at actually knowing anything about Browsers and sometimes even Selenium. Let's cut me out of the way and get you closer to the sources of information.
The side-runner is just a thin opinionated wrapper on jest and selenium-webdriver, which is part of selenium core. The answers you're looking for are likely there. Probably something changed here as selenium-webdriver came up versions.
Basically, use the -D flag to print everything out about your command. There will be a block like this:
Configuration: {
baseUrl: '',
capabilities: { browserName: 'chrome' },
debug: undefined,
debugConnectionMode: true,
debugStartup: true,
filter: '.*',
force: undefined,
maxWorkers: 10,
screenshotFailureDirectory: undefined,
projects: [ '/Users/toddtarsi/Code/selenium-ide/tests/examples/blank.side' ],
proxyOptions: {},
proxyType: undefined,
retries: 0,
runId: '9eb19f07da5b2e5d0be7c6519012c2bf',
path: '/Users/toddtarsi/.nvm/versions/node/v20.11.1/lib/node_modules/',
server: '',
jestTimeout: 60000,
timeout: 15000
}
Grab the capabilities off of that. Next, print out the version of selenium-webdriver on your system.
npm ls selenium-webdriver
Or if it's installed globally
npm ls -g selenium-webdriver
You want to have something like this:
selenium-webdriver issue
version: 4.22.0
capabilities: { browserName: 'chrome' }
Take that here:
https://github.com/SeleniumHQ/selenium/issues/new?assignees=&labels=I-defect%2Cneeds-triaging&projects=&template=bug-report.yml&title=%5B%F0%9F%90%9B+Bug%5D%3A+
And use that to work with people who really understand this stuff a lot better, and can ask you relevant questions and explain browser things and stuff.
Thanks @toddtarsi I will grab that required diagnostic information as suggested by you and raise a new issue. Will update the new issue here also.
Thanks, fmrahman.
I see the .side file interacting with a website, how are you generating the HAR? What does the following actually mean?
I am using the API devtools.network.getHAR() to capture the HAR from my Chrome plugin. I am dumping the HAR data during the onLoad and onClick events.
Is that a manual step? Automated? I am not aware of Selenium IDE doing that.
I am generating the HAR by calling the API chrome.devtools.network.getHAR() on the click events, when the side file execution happens. This is automated step. My Chrome plugin is loaded as part of the browser. This dumping of HAR code is part of the plugin.
OK, so that is something your Chrome plugin does. The event is triggered, but the plugin does not generate the information. Is that right?
Right. The output of the HAR is not correct.
OK, have you checked if your Chrome plugin is compatible with the latest Chrome and ChromeDriver? Bear in mind that CDP (what helps to generate the HAR under the hood) changes often, and it is not compatible with all browser versions.
Yes, I assume it is compatible. Since the plugin got loaded in the Chrome browser. I am just calling the API to get the HAR in the plugin.
That is the only pointer I can give you because, based on your setup, Selenium IDE is not related to the HAR generation. You should check with the plugin authors.
Thanks much for the help. This is my Chrome plugin. I am the author. Would like to know what is the role of selenium-webdriver in this issue. Does the selenium-webdriver truncates the HAR or changes the HAR when calling the API.
Not at all. I know other plugins, such as https://github.com/blibli-badak/selenium-har-util, and they work well. Selenium does not manipulate the data.
I suggest you debug your plugin and see the differences when you use the latest browser version.
sure. Thanks very much for your quick responses. You are nice guy. :-)
Thank you.
Please remember that many of us are volunteers, and we reply to these issues in our free time.
I will close this issue, and if you have clear evidence of a failure in Selenium, please open a new issue.
This issue has been automatically locked since there has not been any recent activity since it was closed. Please open a new issue for related bugs.