MCPcopy
hub / github.com/codeceptjs/CodeceptJS / click

Method click

lib/helper/WebDriver.js:1077–1090  ·  view source on GitHub ↗

* {{> click }} *

(locator, context = null)

Source from the content-addressed store, hash-verified

1075 *
1076 */
1077 async click(locator, context = null) {
1078 const clickMethod = this.browser.isMobile && this.browser.capabilities.platformName !== 'android' ? 'touchClick' : 'elementClick'
1079 const locateFn = prepareLocateFn.call(this, context)
1080
1081 const res = await findClickable.call(this, locator, locateFn)
1082 if (context) {
1083 assertElementExists(res, locator, 'Clickable element', `was not found inside element ${new Locator(context)}`)
1084 } else {
1085 assertElementExists(res, locator, 'Clickable element')
1086 }
1087 const elem = selectElement(res, locator, this)
1088 highlightActiveElement.call(this, elem)
1089 return this.browser[clickMethod](getElementId(elem))
1090 }
1091
1092 /**
1093 * {{> forceClick }}

Callers 2

rightClickMethod · 0.45
clickXYMethod · 0.45

Calls 3

selectElementFunction · 0.90
getElementIdFunction · 0.85
assertElementExistsFunction · 0.70

Tested by

no test coverage detected