clearValue method doesn't work at all
See original GitHub issueEnvironment (please complete the following information):
- **WebdriverIO version: 5.12.5
- **Mode: chromedriver
- If WDIO Testrunner, running sync/async: sync
- **Node.js version: v10
- **NPM version: 6.4.1
- Browser name and version: Chrome 76
- **Platform name and version: Windows
- **Additional wdio packages used (if applicable): “@types/chai”: “^4.2.2”, “@types/mocha”: “^5.2.7”, “@types/node”: “^10.14.17”, “@wdio/cli”: “^5.12.5”, “@wdio/local-runner”: “^5.12.5”, “@wdio/mocha-framework”: “^5.12.1”, “@wdio/spec-reporter”: “^5.12.1”, “@wdio/sync”: “^5.12.3”, “wdio-chromedriver-service”: “^5.0.2”, “chromedriver”: “^76.0.1”, “chai”: “^4.2.0”, “mocha”: “^5.2.0”, “ts-node”: “^7.0.1”, “tsconfig-paths”: “^3.8.0”, “tslint”: “^5.19.0”, “typescript”: “^3.6.2”, “webdriverio”: “^5.12.5”
Config of WebdriverIO Example config from the official tutorial
Describe the bug After using setValue method to input text into ‘input’ element. It’s impossible to clear the value.
To Reproduce
$('//input[@placeholder="Search…"]').setValue(term); $('//input[@placeholder="Search…"]').clearValue();
or
$('//input[@placeholder="Search…"]').setValue(term); $('//input[@placeholder="Search…"]').click(); $('//input[@placeholder="Search…"]').clearValue();
Expected behavior As documentation says:
Clear a <textarea> or text element’s value. Make sure you can interact with the element before using this command. You can’t clear an input element that is disabled or in readonly mode.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:5
- Comments:20 (7 by maintainers)
Top Results From Across the Web
clearValue() is not working in ClientScript - ServiceNow
Hi All, code in client Script: function onChange(control, oldValue, newValue, isLoading) { clearValue is not working so i have used.
Read more >clearValue - WebdriverIO
clearValue. Clear the value of an input or textarea element. Make sure you can interact with the element before using this command.
Read more >SetValue & ClearValue in WebDriverIO - Part - 9 - YouTube
webdriverio #nodejs #javascript #automationIn this video, I have explained how to automate Login page - setValue and getValue methods in ...
Read more >ClearValue Tax - YouTube
Any stock purchases I show on video should not be considered “investment recommendations”. I shall not be held liable for any losses you...
Read more >selenium clear() command doesn't clear the element
I cleared a text field using webelement.clear() method, later while executing next command (click event), the text area I had previously cleared ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I was having this issue on a React frontend 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:
Not sure if the OP was running into the same thing we were, but I want to post this in case anyone else finds this.
clearValueis implemented withinput.value = "", which if it’s a controlled input will be wiped on the next render with whatever is in the state. #gotcha