selenium icon indicating copy to clipboard operation
selenium copied to clipboard

setValue appends instead of overwriting the value

Open swetashahi opened this issue 9 years ago • 3 comments

Originally raised here

Problem During my test, I fill up some values and then edit them. Assume a amount field which is blank at the beginning the test. The sequence of steps is as follows

Test start Fill 50000 in targetAmount field Console log the value (result = 50,000) Clear the field Console log the value (result = ) Enter new value 60000 Console log the value (result = 50,00060,000). (commas are auto-inserted) Save The value that gets saved is 50,00060,000 I have added console log after every step for the targetAmount field. After clear step, the value that is logged is "" (blank). But on next step when I set a new value, the new value is appended to the previous value

Meta -

OS & Environment:
Mac OS X WebdriverIO version: 4.8.0 Node.js version: 7.4.0 Test runner: wdio testrunner Running synchronous or asynchronous tests: synchronous Additional wdio packages: wdio-selenium-standalone-service: 0.0.7 wdio-mocha-framework: 0.5.10 chromedriver 2.31.488774 Browser:
Chrome

Selenium/Webdriverio Logs [14:13:09] DATA {"using":"id","value":"targetAmount"} [14:13:09] RESULT {"ELEMENT":"33"} [14:13:09] COMMAND GET "/wd/hub/session/6ba985c0-93f0-45bb-84cf-17bed6a00ffa/element/33/attribute/value" [14:13:09] DATA {} [14:13:09] RESULT "$ 50,000" the value in amount field is $ 50,000 [14:13:09] COMMAND POST "/wd/hub/session/6ba985c0-93f0-45bb-84cf-17bed6a00ffa/element" [14:13:09] DATA {"using":"id","value":"targetAmount"} [14:13:09] RESULT {"ELEMENT":"33"} [14:13:09] COMMAND POST "/wd/hub/session/6ba985c0-93f0-45bb-84cf-17bed6a00ffa/element/33/click" [14:13:09] DATA {} [14:13:09] COMMAND POST "/wd/hub/session/6ba985c0-93f0-45bb-84cf-17bed6a00ffa/element" [14:13:09] DATA {"using":"id","value":"targetAmount"} [14:13:09] RESULT {"ELEMENT":"33"} [14:13:09] COMMAND POST "/wd/hub/session/6ba985c0-93f0-45bb-84cf-17bed6a00ffa/element/33/clear" [14:13:09] DATA {} [14:13:09] COMMAND POST "/wd/hub/session/6ba985c0-93f0-45bb-84cf-17bed6a00ffa/element" [14:13:09] DATA {"using":"id","value":"targetAmount"} [14:13:09] RESULT {"ELEMENT":"33"} [14:13:09] COMMAND GET "/wd/hub/session/6ba985c0-93f0-45bb-84cf-17bed6a00ffa/element/33/attribute/value" [14:13:09] DATA {} the value in amount field is [14:13:09] COMMAND POST "/wd/hub/session/6ba985c0-93f0-45bb-84cf-17bed6a00ffa/element" [14:13:09] DATA {"using":"id","value":"targetAmount"} [14:13:09] RESULT {"ELEMENT":"33"} [14:13:09] COMMAND POST "/wd/hub/session/6ba985c0-93f0-45bb-84cf-17bed6a00ffa/element/33/clear" [14:13:09] DATA {} [14:13:09] COMMAND POST "/wd/hub/session/6ba985c0-93f0-45bb-84cf-17bed6a00ffa/element/33/value"

Code To Reproduce Issue

Code in spec file console.log('the value in amount field is ',DetailPage.targetAmount.getValue()); DetailPage.targetAmount.click(); DetailPage.targetAmount.clearElement(); console.log('the value in amount field is ',DetailPage.targetAmount.getValue()); DetailPage.targetAmount.setValue('60000'); console.log('the value in amount field is ',DetailPage.targetAmount.getValue()); DetailPage.saveAndRecalc();

In the page object file (DetailPage.page.js) targetAmount: { get: function () { return $('#targetAmount');} },

-->

Browser Version:

Expected Behavior -

Actual Behavior -

Steps to reproduce -

swetashahi avatar Aug 10 '17 16:08 swetashahi

webdriver.io is an independent implementation, it's not based on selenium source base, so we can't help with tihs issue.

barancev avatar Aug 10 '17 18:08 barancev

@barancev The author of webdriverio confirmed its not a webdriverio issue but one of chromedriver. (Webdriverio is a Node.js bindings implementation for the WebDriver protocol)

swetashahi avatar Aug 10 '17 21:08 swetashahi

If it's a chromedriver issue it should be reported to the chromedriver tracker: https://sites.google.com/a/chromium.org/chromedriver/help

barancev avatar Aug 10 '17 21:08 barancev