testcafe
testcafe copied to clipboard
CleanAttributes() dosn't work with Attribute "length"
What is your Scenario?
When a wrapper element contains an attribute which is named "length". The for loop crashes because the length attribute got removed. This breaks the Test execution in Testcafe
https://github.com/DevExpress/testcafe-hammerhead/blob/a878aefb01e45c3dc58d9d92da6e618cbc494c4c/src/client/sandbox/node/attributes/index.ts#L8
What is the Current behavior?
Testcafe execution fails when element has an attribute named "length"
What is the Expected behavior?
Testcafe works as expected
What is your public website URL? (or attach your complete example)
http://axas-welt.de/
What is your TestCafe test code?
import { Selector } from 'testcafe';
fixture`Getting Started`
.page`http://axas-welt.de/`;
test('My first test', async t => {
await t
.typeText("#myId", "Hallo")
});
### Your complete configuration file
{ "browsers": "chrome", "selectorTimeout": 45000, "assertionTimeout": 45000, "pageLoadTimeout": 45000, "screenshots": { "takeOnFails": false }, "skipJsErrors": true, "disableHttp2": true }
Your complete test report
No response
Screenshots
Steps to Reproduce
- Execute Test
TestCafe version
1.18.4
Node.js version
v16.14.0
Command-line arguments
testcafe test.ts
Browser name(s) and version(s)
Chrome
Platform(s) and version(s)
Windows
Other
As workaround i changed the for loop with skipping the deletion of the attribute
function cleanAttributes(wrapper) {
if (wrapper.length) {
for (var i = 0; i < wrapper.length; i++) {
if(wrapper[i].name == "length")
{
continue;
}
delete wrapper[wrapper[i].name];
delete wrapper[i];
}
}
}
Hi @lisandrogreco
Thank you for the shared information. I've reproduced the issue.
If it's ok for you i would implement the workaround mentioned above to prevent this issue. I could to then a PR. For us it would be better if we could still use the "original" version of testcafe and testcafe-hammerhead instead of our custom fixed version
I'm afraid that your workaround isn't suitable for us. We will research the issue and update this thread once we have any news.
We will close this issue since it is fixed in the Native Automation mode. Please try the native automation mode in your tests. Feel free to reopen the issue if you need a fix for the other browsers or you cannot use Native Automation for some reason.