webdriverio icon indicating copy to clipboard operation
webdriverio copied to clipboard

clearValue can't use

Open allahbin-super opened this issue 5 years ago • 2 comments

[//]: # NOTE: This repository only maintains packages that are listed in the Readme. Please make sure that your issue is directly caused by one of these packages and if not file an issue in the correct 3rd party package repository.

Environment (please complete the following information):

  • WebdriverIO version: [7.3.0]
  • Mode: []
  • If WDIO Testrunner, running sync/async: [e.g. sync/async]
  • Node.js version: [v14.16.0]
  • NPM version: [e.g. 5.8.0]
  • Browser name and version: [e.g. Chrome 68]
  • Platform name and version: [e.g. Mac OS]
  • Additional wdio packages used (if applicable): [e.g. @wdio/cli]

Config of WebdriverIO default WebdriverIO config

Describe the bug clearValue Can't use

To Reproduce

        this.inputUsername.setValue(username);
        browser.pause(2000);
        this.inputUsername.clearValue(username);
        browser.pause(2000);

https://github.com/Tzng/webdriver-test

Expected behavior clear input value

allahbin-super avatar Apr 08 '21 03:04 allahbin-super

Hey @Tzng ,

thanks for filing the issue. This seems to be related to Chromedriver, so I filled a bug in that project. There is nothing we can do to fix it. As a workaround I recommend doing this:

browser.overwriteCommand('clearValue', function () {
    browser.execute((elem) => (elem.value = ''), this)
}, true)

This would overwrite the clearValue command and would clear it through JS. I tested it and it works well. You can have this statement in your before hook in your wdio.conf.js.

christian-bromann avatar Apr 08 '21 08:04 christian-bromann

Hey @Tzng ,

thanks for filing the issue. This seems to be related to Chromedriver, so I filled a bug in that project. There is nothing we can do to fix it. As a workaround I recommend doing this:

browser.overwriteCommand('clearValue', function () {
    browser.execute((elem) => (elem.value = ''), this)
}, true)

This would overwrite the clearValue command and would clear it through JS. I tested it and it works well. You can have this statement in your before hook in your wdio.conf.js.

Hey @Tzng ,

thanks for filing the issue. This seems to be related to Chromedriver, so I filled a bug in that project. There is nothing we can do to fix it. As a workaround I recommend doing this:

browser.overwriteCommand('clearValue', function () {
    browser.execute((elem) => (elem.value = ''), this)
}, true)

This would overwrite the clearValue command and would clear it through JS. I tested it and it works well. You can have this statement in your before hook in your wdio.conf.js.

Okay, this is really great

allahbin-super avatar Apr 08 '21 12:04 allahbin-super