nightwatch: clearValue is not clearing the value
Hello, I have a box with a text value inside. So I want to call it using
.clearValue(element.durInput)
but it’s not clearing the value and so when I use .setValue it appends the new value instead of replacing. I wanted to instead use the code for keypress to press ctrl-a and then backspace to clear it. I’m using the code
browser.keys([browser.Keys.CONTROL, "a"])
browser.keys("8")
but I’m sure it’s wrong since it’s not working. Any idea how to make it work? Thanks in advance
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Comments: 25 (3 by maintainers)
Commits related to this issue
- Add workaround for selenium/firefox test issue https://github.com/nightwatchjs/nightwatch/issues/504 — committed to ConnorStroomberg/molgenis-ui-form by ConnorStroomberg 6 years ago
- test: run firefox tests on mac To work around https://github.com/nightwatchjs/nightwatch/issues/504, run on mac instead. It's a windows/firefox problem. — committed to fdlk/molgenis-ui-form by fdlk 5 years ago
Clicking on the element prior to clearing does the trick for me.
I really suffered with this one today, so I share my solution since none of the other solutions worked for me for chrome & firefox:
`exports.command = function (fieldSelector) { const browserName = this.options.desiredCapabilities.browserName;
if (browserName === ‘chrome’) { this.getValue(fieldSelector, function (result) { this.setValue(fieldSelector, […(result.value || ‘’)].map(char => ‘\u0008’)); }); } else { this.clearValue(fieldSelector); }
return this; };`
This is a command to do one thing for chrome and other one for firefox
On the newest version of nightwatch and still having this issue, please fix
What was the resolution on this issue? I am seeing this issue but only when running the test against IE 11. Chrome and Firefox clear the field just fine.
We’ve also noticed that this problem only occurs in React applications. So, I wanted to ask here if there is someone who is facing the same issue with the
clearValuecommand but not working on a React application.In headless mode,
setValueis working for me, but not withheadless: false(nightwatch 2.4.1).I have the exact same issue too - on chrome 87