-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add fallback for clearValue
command
#4028
Comments
I want to work on this issue could you assign this issue to me. |
Hi @garg3133 I would like to work on this issue. |
Hi, please go through GSoC Contributor Guidance for Nightwatch. It contains details on how the issues will be assigned. |
Hi @garg3133 |
Hello, I tried the method @FireNdIce3 suggested and it works just fine. Using backspaces is not the most efficient way especially if the text field is lengthy, but it is definitely a viable approach. |
Hi, I do think the same, sending back_space keys is not the best approach, rather we can select all text within the input field, i.e:-
and then press the delete key ;)
|
Hey, thanks for all the inputs. Considering how webdrivers work and that the real issue here due to which the Moreover, using Now, I agree that using a for loop is not the best solution, so I'd suggest to directly send an array of @FireNdIce3 Let us know if you'd like to take this up since you were the first one to suggest a potential solution. |
@garg3133 |
Hi @garg3133 |
Hi, no worries! I don't fully understand what you mean by "the web driver isn't getting updated". What issue are you facing exactly? |
Apologies |
@FireNdIce3 No need to apologise. Which selenium methods are you talking about? If you're talking about the Also, how have you set up the project? Did you fork and clone this project or did you use |
Hi! |
for reference I did the following changes
I even tried to throw an error to check whether the test will throw error or not but it's still running fine |
Hey, I understand your issue now. If you've already setup the Nightwatch project, you didn't need to run An easy fix should be to revert all the changes in Then use |
Hi @garg3133 |
@FireNdIce3 Cool |
Fixed in #4035. |
Description of the bug/issue
It's been reported multiple times in the past that the
browser.clearValue()
command does not work as expected in a few cases (see #4026).And although this is actually an issue with the webdrivers, we should still consider adding a fallback to the
clearValue
command until the issue is resolved at the webdrivers end. Doing so would help Nightwatch users not waste time trying to figure out what went wrong with their test and how to fix it, while the issue exists in the webdriver.Steps to reproduce
npm init nightwatch@latest <project-name>
(with defaults)cd <project-name>
clearValueTest.js
insidetest
folder, with the sample test provided below.npx nightwatch ./test/clearValueTest.js
Sample test
Potential Fix
Inside the
clearElementValue
method oflib/transport/selenium-webdriver/method-mappings.js
file, after running theclear()
command, check if the element still has some value, and if it does, sendBACK_SPACE
keys to the element till it is cleared.The
element
variable in the above method represents theWebElement
class of Selenium.Nightwatch.js Version
3.4.1
Node Version
No response
Browser
Chrome, Edge and Safari. Works fine on Firefox.
Operating System
No response
Additional Information
No response
The text was updated successfully, but these errors were encountered: