Open chris-jackson-actionqa opened 7 months ago
Does it only append in Chrome or does it append in Firefox as well?
I haven't tried Firefox.
-- Chris Jackson
On Fri, Feb 16, 2024 at 9:48 AM Priyansh Garg @.***> wrote:
Does it only append in Chrome or does it append in Firefox as well?
— Reply to this email directly, view it on GitHub https://github.com/nightwatchjs/nightwatch/issues/4026#issuecomment-1948977467, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB2UI262GQ3SM5UBWHNPXMTYT6LVXAVCNFSM6AAAAABDMK2MA2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNBYHE3TONBWG4 . You are receiving this because you authored the thread.Message ID: @.***>
browser.clearValue isn't clearing the value, either.
I had to write the following code to clear the input:
async function clearValue(browser, selector) {
const value = await browser.getValue(selector);
for (let i = 0; i < value.length; i++) {
await browser.element(selector).sendKeys("\uE003");
}
}
That code works to clear the input, but not browser.clearValue
I tried this on Firefox and the updateValue
command is working fine over there.
This bug seems to be only present in Chromium-based browsers (Chrome, Edge, etc.) where the clear command is not able to reset the value of input fields and still return a 200 response code, and it needs to be fixed by browser vendors only. Moreover, it seems to be happening in React applications mostly.
But if the issue is not fixed by the browser vendors sooner, maybe we could add a fallback to the clearValue
command in Nightwatch where if the input field contains a value even after the completion of the clearValue
command, Nightwatch would fall back to the workaround suggested by you.
cc: @AutomatedTester
Edit: The issue seems to be present in Safari browser as well.
Thank you for investigating. I'm not sure what the proper course of action
is. If updateValue
or clearValue
aren't working as expected, they
should fail with an error message explaining how to workaround the issue.
Otherwise, test writers are going to waste a ton of time trying to figure
out what went wrong.
-- Chris Jackson
On Tue, Feb 20, 2024 at 12:40 AM Priyansh Garg @.***> wrote:
I tried this on Firefox and the updateValue command is working fine over there.
This bug seems to be only present in Chromium-based browsers (Chrome, Edge, etc.) where the clear command is not able to reset the value of input fields and still return a 200 response code, and it needs to be fixed by browser vendors only. Moreover, it seems to be happening in React applications mostly.
But if the issue is not fixed by the browser vendors sooner, maybe we could add a fallback to the clearValue command in Nightwatch where if the input field contains a value even after the completion of the clearValue command, Nightwatch would fall back to the workaround suggested by you.
cc: @AutomatedTester https://github.com/AutomatedTester
— Reply to this email directly, view it on GitHub https://github.com/nightwatchjs/nightwatch/issues/4026#issuecomment-1953719575, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB2UI2ZVPYFSL5Q5YK6WC5DYUROOVAVCNFSM6AAAAABDMK2MA2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNJTG4YTSNJXGU . You are receiving this because you authored the thread.Message ID: @.***>
You're absolutely right. But how Nightwatch works is when you execute the clearValue
command it sends an HTTP request to the webdriver server (chromedriver, geckodriver, etc.) to clear the field and the webdriver sends back a response based on whether the task was successfully completed or not.
In this case, the webdriver server is sending back a 200 response code even when the input field isn't actually cleared, and so, because of the 200 response code, Nightwatch assumes that the webdriver must have completed its task and moves on.
The next course of action here (on our side) would be to narrow down the issue further (to find out what's actually causing it) and then raise it with the Chrome/Safari team.
But since that might take long, I think it'd be better to add a fallback in the clearValue
command in Nightwatch to handle such cases. I'll raise a new issue for that shortly.
I'll trust your judgement. Thank you for investigating this. And I appreciate your quick response.
-- Chris Jackson
On Wed, Feb 21, 2024 at 2:15 AM Priyansh Garg @.***> wrote:
You're absolutely right. But how Nightwatch works is when you execute the clearValue command it sends an HTTP request to the webdriver server (chromedriver, geckodriver, etc.) to clear the field and the webdriver sends back a response based on whether the task was successfully completed or not.
In this case, the webdriver server is sending back a 200 response code even when the input field isn't actually cleared, and so, because of the 200 response code, Nightwatch assumes that the webdriver must have completed its task and moves on.
The next course of action here (on our side) would be to narrow down the issue further (to find out what's actually causing it) and then raise it with the Chrome/Safari team.
But since that might take long, I think it'd be better to add a fallback in the clearValue command in Nightwatch to handle such cases. I'll raise a new issue for that shortly.
— Reply to this email directly, view it on GitHub https://github.com/nightwatchjs/nightwatch/issues/4026#issuecomment-1956315464, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB2UI27VSZHCF2VCHZ5ALMDYUXCMNAVCNFSM6AAAAABDMK2MA2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNJWGMYTKNBWGQ . You are receiving this because you authored the thread.Message ID: @.***>
This should ideally be resolved in the latest release of Nightwatch (v3.6.1
), can you please check?
Description of the bug/issue
I'm using
updateValue
to edit a form that already has values in the input fields. However,updateValue
is only appending text instead of replacing the text.Steps to reproduce
npx nightwatch -e chrome test/bills/editBill.ts
Sample test
Command to run
Verbose Output
Nightwatch Configuration
Nightwatch.js Version
3.4.1
Node Version
v18.19.0
Browser
Version 121.0.6167.139 (Official Build) (x86_64)
Operating System
macOS Sonoma 14.2.1 (23C71)
Additional Information
No response