MCPcopy Index your code
hub / github.com/codeceptjs/CodeceptJS / rightClick

Method rightClick

lib/helper/WebDriver.js:1141–1160  ·  view source on GitHub ↗

* {{> rightClick }} *

(locator, context)

Source from the content-addressed store, hash-verified

1139 *
1140 */
1141 async rightClick(locator, context) {
1142 const locateFn = prepareLocateFn.call(this, context)
1143
1144 const res = await findClickable.call(this, locator, locateFn)
1145 if (context) {
1146 assertElementExists(res, locator, 'Clickable element', `was not found inside element ${new Locator(context)}`)
1147 } else {
1148 assertElementExists(res, locator, 'Clickable element')
1149 }
1150
1151 const el = selectElement(res, locator, this)
1152
1153 await el.moveTo()
1154
1155 if (this.browser.isW3C) {
1156 return el.click({ button: 'right' })
1157 }
1158 // JSON Wire version
1159 await this.browser.buttonDown(2)
1160 }
1161
1162 /**
1163 * Performs click at specific coordinates.

Callers

nothing calls this directly

Calls 3

selectElementFunction · 0.90
assertElementExistsFunction · 0.70
clickMethod · 0.45

Tested by

no test coverage detected