Skip to content

Commit

Permalink
Add missing documentation (#3826)
Browse files Browse the repository at this point in the history
* add missing documentation

* add method names
  • Loading branch information
swrdfish authored Jul 24, 2023
1 parent 3cf114f commit 51f2d2d
Show file tree
Hide file tree
Showing 15 changed files with 43 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/api/protocol/forward.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const ProtocolAction = require('./_base-action.js');
/**
* Navigate forward in the browser history, if possible (the equivalent of hitting the browser forward button).
*
* @method forward
* @link /#back
* @param {function} [callback] Optional callback function to be called when the command finishes.
* @api protocol.navigation
Expand Down
1 change: 1 addition & 0 deletions lib/api/protocol/frame.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const ProtocolAction = require('./_base-action.js');
* });
* }
*
* @method frame
* @link /#switch-to-frame
* @param {string|number|null} [frameId] Identifier for the frame to change focus to.
* @param {function} [callback] Optional callback function to be called when the command finishes.
Expand Down
1 change: 1 addition & 0 deletions lib/api/protocol/frameParent.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const ProtocolAction = require('./_base-action.js');
* });
* }
*
* @method frameParent
* @link /#switch-to-parent-frame
* @param {function} [callback] Optional callback function to be called when the command finishes.
* @since v0.4.8
Expand Down
1 change: 1 addition & 0 deletions lib/api/protocol/refresh.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const ProtocolAction = require('./_base-action.js');
/**
* Refresh the current page.
*
* @method refresh
* @link /#refresh
* @param {function} [callback] Optional callback function to be called when the command finishes.
* @api protocol.navigation
Expand Down
1 change: 1 addition & 0 deletions lib/api/protocol/screenshot.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const ProtocolAction = require('./_base-action.js');
/**
* Take a screenshot of the current page.
*
* @method screenshot
* @link /#take-screenshot
* @param {boolean} log_screenshot_data Whether or not the screenshot data should appear in the logs when running with --verbose
* @param {function} callback Callback function which is called with the result value.
Expand Down
1 change: 1 addition & 0 deletions lib/api/protocol/session.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const ProtocolAction = require('./_base-action.js');
* }
*
*
* @method session
* @link /#new-session
* @editline L141
* @syntax .session([action], [sessionId], [callback])
Expand Down
1 change: 1 addition & 0 deletions lib/api/protocol/sessions.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const ProtocolAction = require('./_base-action.js');
* });
* }
*
* @method sessions
* @editline L166
* @section sessions
* @syntax .sessions(callback)
Expand Down
1 change: 1 addition & 0 deletions lib/api/protocol/status.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const ProtocolAction = require('./_base-action.js');
/**
* Query the server's current status.
*
* @method status
* @link /#status
* @syntax .status([callback])
* @param {function} callback Callback function which is called with the result value.
Expand Down
1 change: 1 addition & 0 deletions lib/api/protocol/submit.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const ProtocolAction = require('./_base-action.js');
/**
* Submit a FORM element. The submit command may also be applied to any element that is a descendant of a FORM element.
*
* @method submit
* @param {string} webElementId The [Web Element ID](https://www.w3.org/TR/webdriver1/#dfn-web-elements) of the element to route the command to.
* @param {function} [callback] Optional callback function to be called when the command finishes.
* @api protocol.elementinternal
Expand Down
1 change: 1 addition & 0 deletions lib/api/protocol/timeouts.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const ProtocolAction = require('./_base-action.js');
* });
* }
*
* @method timeouts
* @link /#set-timeout
* @editline L188Í
* @syntax .timeouts([callback])
Expand Down
1 change: 1 addition & 0 deletions lib/api/protocol/timeoutsAsyncScript.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const ProtocolAction = require('./_base-action.js');
* });
* }
*
* @method timeoutsAsyncScript
* @syntax .timeoutsAsyncScript(ms, [callback])
* @jsonwire
* @param {number} ms The amount of time, in milliseconds, that time-limited commands are permitted to run.
Expand Down
1 change: 1 addition & 0 deletions lib/api/protocol/timeoutsImplicitWait.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const ProtocolAction = require('./_base-action.js');
* });
* }
*
* @method timeoutsImplicitWait
* @jsonwire
* @syntax .timeoutsImplicitWait(ms, [callback])
* @param {number} ms The amount of time, in milliseconds, that time-limited commands are permitted to run.
Expand Down
1 change: 1 addition & 0 deletions lib/api/protocol/url.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const ora = require('ora');
* }
* }
*
* @method url
* @link /#navigate-to
* @syntax .url([url], [callback])
* @syntax .url(callback)
Expand Down
1 change: 1 addition & 0 deletions lib/api/protocol/waitUntil.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const ProtocolAction = require('./_base-action.js');
* });
* }
*
* @method waitUntil
* @link https://www.selenium.dev/selenium/docs/api/javascript/module/selenium-webdriver/index_exports_WebDriver.html#wait
* @selenium_webdriver
* @syntax .waitUntil(conditionFn, [callback])
Expand Down
29 changes: 29 additions & 0 deletions lib/api/web-element/commands/setValue.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,32 @@
/**
* 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.
*
* <div class="alert alert-warning">From Nightwatch v2, <strong>setValue</strong> also clears the existing value of the element by calling the <strong>clearValue()</strong> beforehand.</div>
*
* 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 <a href="https://nightwatchjs.org/guide/writing-tests/finding-interacting-with-dom-elements.html">Finding & interacting with DOM Elements</a> guide page.
* @example
* // send some simple text to an input
* this.demoTest = function (browser) {
* const result = await browser.element('input[type=text]').setValue('nightwatch');
* };
*
* // send some text to an input and hit enter.
* this.demoTest = function (browser) {
* const result = await browser.element('input[type=text]').setValue(['nightwatch', browser.Keys.ENTER]);
* };
*
*
* @link /session/:sessionId/element/:id/value
* @method setValue
* @memberof ScopedWebElement
* @instance
* @syntax browser.element(selector).setValue(inputValue)
* @param {string|array} inputValue The text to send to the element or key strokes.
* @param {function} [callback] Optional callback function to be called when the command finishes.
* @link https://www.w3.org/TR/webdriver#element-send-keys
*/
module.exports.command = function(...args) {
const keys = args.reduce((prev, key) => {
const keyList = Array.isArray(key) ? key : [key];
Expand Down

0 comments on commit 51f2d2d

Please sign in to comment.