From b64d103e4157cb0fa2fdfc719bcbd62a12f772bf Mon Sep 17 00:00:00 2001 From: Priyansh Garg Date: Thu, 30 May 2024 14:54:24 +0530 Subject: [PATCH] Small modifications in API docs for updating value. (#4213) --- lib/api/element-commands/updateValue.js | 2 +- lib/api/web-element/commands/setValue.js | 2 +- lib/api/web-element/commands/update.js | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/api/element-commands/updateValue.js b/lib/api/element-commands/updateValue.js index b6edef932a..7c2c907d7a 100644 --- a/lib/api/element-commands/updateValue.js +++ b/lib/api/element-commands/updateValue.js @@ -3,7 +3,7 @@ const BaseElementCommand = require('./_baseElementCommand.js'); /** * Sends some text to an element. Can be used to set the value of a form element or to send a sequence of key strokes to an element. Any UTF-8 character may be specified. * - *
updateValue is equivalent with setValue and sendKeys with the exception that it clears the value beforehand.
+ *
updateValue is equivalent with setValue in that it also clears the value beforehand.
* * An object map with available keys and their respective UTF-8 characters, as defined on [W3C WebDriver draft spec](https://www.w3.org/TR/webdriver/#character-types), is loaded onto the main Nightwatch instance as `browser.Keys`. * diff --git a/lib/api/web-element/commands/setValue.js b/lib/api/web-element/commands/setValue.js index 44cd424991..ec249246a1 100644 --- a/lib/api/web-element/commands/setValue.js +++ b/lib/api/web-element/commands/setValue.js @@ -1,7 +1,7 @@ /** * Sends some text to an element. Can be used to set the value of a form element or to send a sequence of key strokes to an element. Any UTF-8 character may be specified. * - *
From Nightwatch v2, setValue also clears the existing value of the element by calling the clearValue() beforehand.
+ *
setValue also clears the existing value of the element by calling the clear() beforehand.
* * An object map with available keys and their respective UTF-8 characters, as defined on [W3C WebDriver draft spec](https://www.w3.org/TR/webdriver/#character-types), is loaded onto the main Nightwatch instance as `browser.Keys`. * diff --git a/lib/api/web-element/commands/update.js b/lib/api/web-element/commands/update.js index 8827ef951f..c815e1dd68 100644 --- a/lib/api/web-element/commands/update.js +++ b/lib/api/web-element/commands/update.js @@ -1,6 +1,8 @@ /** * Sends some text to an element. Can be used to set the value of a form element or to send a sequence of key strokes to an element. Any UTF-8 character may be specified. * + *
update also clears the existing value of the element by calling the clear() beforehand.
+ * * An object map with available keys and their respective UTF-8 characters, as defined on [W3C WebDriver draft spec](https://www.w3.org/TR/webdriver/#character-types), is loaded onto the main Nightwatch instance as `browser.Keys`. * * For more info on working with DOM elements in Nightwatch, refer to the Finding & interacting with DOM Elements guide page.