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

Method evaluate

lib/element/WebElement.js:268–278  ·  view source on GitHub ↗

* Run a function in the browser with this element as the first argument. * @param {Function} fn Browser-side function. Receives the element, then extra args. * @param {...any} args Additional arguments passed to the function * @returns {Promise } Value returned by fn

(fn, ...args)

Source from the content-addressed store, hash-verified

266 * @returns {Promise<any>} Value returned by fn
267 */
268 async evaluate(fn, ...args) {
269 switch (this.helperType) {
270 case 'playwright':
271 case 'puppeteer':
272 return this.element.evaluate(fn, ...args)
273 case 'webdriver':
274 return this.helper.executeScript(fn, this.element, ...args)
275 default:
276 throw new Error(`Unsupported helper type: ${this.helperType}`)
277 }
278 }
279
280 /**
281 * Focus the element.

Callers 15

getTextMethod · 0.80
getAttributeMethod · 0.80
getPropertyMethod · 0.80
getInnerHTMLMethod · 0.80
getValueMethod · 0.80
isVisibleMethod · 0.80
isEnabledMethod · 0.80
existsMethod · 0.80
typeMethod · 0.80
focusMethod · 0.80
toAbsoluteXPathMethod · 0.80
toOuterHTMLMethod · 0.80

Calls 1

executeScriptMethod · 0.45

Tested by

no test coverage detected