nightwatch
Version:
Easy to use Node.js based end-to-end testing solution for web applications using the W3C WebDriver API.
28 lines (27 loc) • 1.15 kB
JavaScript
/**
* Simulates a context-click(right click) event on the given DOM element. The element is scrolled into view if it is not already pointer-interactable. See the WebDriver specification for element [interactability](https://www.w3.org/TR/webdriver/#element-interactability).
*
* 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
* export default {
* demoTest(browser: NightwatchAPI): void {
* browser.element('#main ul li a.first').rightClick();
* },
*
* async demoTestAsync(browser: NightwatchAPI): Promise<void> {
* await browser.element('#main ul li a.first').rightClick();
* }
* }
*
* @since 3.0.0
* @method rightClick
* @memberof ScopedWebElement
* @instance
* @syntax browser.element(selector).rightClick()
* @see https://www.selenium.dev/documentation/webdriver/actions_api/mouse/#context-click
* @returns {ScopedWebElement}
*/
module.exports.command = function () {
return this.runQueuedCommand('contextClick');
};