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

Method focus

lib/element/WebElement.js:284–296  ·  view source on GitHub ↗

* Focus the element. * @returns {Promise }

()

Source from the content-addressed store, hash-verified

282 * @returns {Promise<void>}
283 */
284 async focus() {
285 switch (this.helperType) {
286 case 'playwright':
287 return this.element.focus()
288 case 'puppeteer':
289 if (this.element.focus) return this.element.focus()
290 return this.element.evaluate(el => el.focus())
291 case 'webdriver':
292 return this.helper.executeScript(el => el.focus(), this.element)
293 default:
294 throw new Error(`Unsupported helper type: ${this.helperType}`)
295 }
296 }
297
298 /**
299 * Type characters via the page/browser keyboard into the focused element.

Callers

nothing calls this directly

Calls 2

evaluateMethod · 0.80
executeScriptMethod · 0.45

Tested by

no test coverage detected