-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
setValue() doesn't clear input before setting new value #1140
Comments
Could you post the selenium logs of that part where you use setValue? |
Sure, here it is that part of selenium log:
|
I am seeing the same problem. The inputs are not cleared (not with setValue() and not with clearElement() either). New values are appended.
I am using webdriverio 4.0.3 and mercury for rendering the html. |
It seems that the command gets executed successful though. Seems to be a Chromedriver issue then. |
Faced the same problem. Input was not cleared with neither clearElement() nor setValue(). However, it starts working for me when I click the input or write something just before clearing (i'm using cucumberjs - and for some strange reason it does not work when I click/write in the same step, but works fine if I do this in previous step). P.S. I'm using selenium: "2.48.2", chromedriver: "2.20", webdriverio: "2.4.5". ReactJS. |
Could you update the selenium standalone server and try again? |
@adolatowska I have just run simple test (see below) with the same webdriverio version, same selenium standalone server, but different FF (45.0.1) and it works fine for me. FYI @christian-bromann var webdriverio = require('../webdriverio');
var options = {
desiredCapabilities: {
browserName: 'firefox'
}
};
webdriverio
.remote(options)
.init()
.url('http://www.google.co.uk')
.setValue('#lst-ib', 'test')
.pause(5000)
.setValue('#lst-ib', 'arek')
.pause(5000)
.end(); Selenoum Logs below
|
I've tested again with Selenium Standalone version 2.53.0 and both FF versions: 45.0.1 and 45.0.2. Situation is the same. Here is Selenium log from run on FF v.45.0.1:
and here is log from run on FF v. 45.0.2:
|
@adolatowska / @christian-bromann is it just me or "clear" send to (//button[.="Przesy?ka kurierska"]/../..//input)[3]]]) but "send keys" to (//button[.="Przesy?ka kurierska"]/../..//input)[3]] Notice the extra " ] " in clear command at the end. It would explain, why its not clearing the values. |
@adolatowska can you try to use a different selector? |
Closing due to inactivity. I am happy to open this again, if this is still valid. |
I also have the same issue with FF 47-49 |
I am having the same problem with both Firefox 53.0.2 and Chrome 58.0.3029.110 and selenium-standalone 6.4.1. I'm testing against a React app, if that helps at all. |
I'm adding a resolution here and on #891 for the workaround I used. It looks like our React DOM isn't updating whenever an element is cleared with .clearElement() and then set again with .setValue(), so I had to backspace out the field one character at a time:
|
@jkwaldrip This workaround didn't work for me. We use react-redux for our front end and using setValue the value is always appended even if I clear the field using clearElement(). or with backspaces as given in your code above.Any other steps I can try? |
Has there been any solution yet. I am still seeing the same issue. Here is my configuration
selenium-server-standalone-2.53.1.jar |
Same issue here. |
Same issue re-introduced here after upgrading to Chromedriver 2.43 - now have to rely on @jkwaldrip's suggestion with backspacing. |
Please try this, it worked for me
|
That was what I did until today, where I updated to latest Chromedriver, and it stopped working. |
I can confirm it. |
@MartinX3 can you prove that this bug is WebdriverIO related? |
Oh, can you help us by providing a link where to put this bug request? I continue my selenium work next week. |
In case others are running into this issue, here is the solution I found:
The solution @jkwaldrip offered worked for me but it was very slow. This backspaces as fast as normal typing. Can anyone confirm if this is indeed a chromedriver issue and how they determined that? |
Found an chromedriver issue, no solution but a workaround. webdriverio/webdriverio#1140
Found an chromedriver issue, no solution but a workaround. webdriverio/webdriverio#1140
i can found good solution.so .....i did it
|
Same issue for:
If you use:
To handle this problem, I found this solution and it works for me:
|
Found an chromedriver issue, no solution but a workaround. webdriverio/webdriverio#1140
// it will clear your text field easily. Note: You can add new text in that text field. |
Just want to leave my two cents on this since the stuff above never worked. I made a utility function and passed in the element ( with TypeScript ).
and I pass in like so...
|
Getting the same issue here. When there is a value set to the input, clear function fails (no matter if the focus is set on the input). But if there is no default value and we type AND then clear, this works. |
@NBukuri your solution only works for inputs that do not contain special characters. |
@defusiner var count= browser.getAttribute(selector, value).length; now send input value to corresponding text field. |
We've done exactly like that. Just wanted to mention that the double click does not work when there is more than 1 word or special characters in the input. |
I struggled with this for a while and write an awkward solution.
|
When I run the tests in my Mac (local) clearValue() is working fine, but when the same tests are run in the Linux Docker environment (circleci/node:10-buster-browsers-legacy), I need to use the workaround which @bob-laz mentioned. Could be better if the same is fixed for Linux environment too. |
I was having this issue on a React frontend, clearValue() wasn't working either, but I was able to get it to work by first clicking the field and then using browser.execute(), like this:
I also had the backspace approach working like this, but the other way seemed a little simpler:
|
This issue still persists in "wdio-chromedriver-service": "^6.0.3" in windows chrome Version 91.0.4472.124 |
$(selector).clearValue() use clear value first before setvalue? |
yes I have used clearValue and then setValue, but no luck :/ |
any example for reproducing this issue |
This issue is still happening with me: The setValue() method is only appending (not replacing) and the clearValue() method does not clear the input. |
I am too, Still facing this issue. I tried both : (1) |
Also experienced this today and piggybacked on the backspace solutions and ended up with new command:
|
I tried the import { Key } from 'webdriverio';
// interact with the selector
await searchBox.doubleClick();
// select all text
await browser.keys([Key.Ctrl, 'a']);
// unpress ctrl key
await browser.keys([Key.Ctrl]);
// presses backspace
await browser.keys(Key.Delete); |
In my test case I have a step where new value is set to a non empty input (with type number). According to webdriverIO API, the setValue method should clear an input at first and then should type a new value. But in my case, setValue appends new value to existing one.
I'm using webdriverIO 3.4.0 with Selenium standalone server 2.52.0 and Firefox 44.0.2. The forms in my application under test are created with React.js library.
The text was updated successfully, but these errors were encountered: