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

Method type

lib/element/WebElement.js:244–260  ·  view source on GitHub ↗

* Type text into the element * @param {string} text Text to type * @param {Object} options Type options * @returns {Promise }

(text, options = {})

Source from the content-addressed store, hash-verified

242 * @returns {Promise<void>}
243 */
244 async type(text, options = {}) {
245 switch (this.helperType) {
246 case 'playwright':
247 // Playwright Locator objects use fill() instead of type()
248 if (this.element.fill) {
249 return this.element.fill(text, options)
250 }
251 return this.element.type(text, options)
252 case 'webdriver':
253 return this.element.setValue(text)
254 case 'puppeteer':
255 await this.element.evaluate(el => { el.value = '' })
256 return this.element.type(text, options)
257 default:
258 throw new Error(`Unsupported helper type: ${this.helperType}`)
259 }
260 }
261
262 /**
263 * Run a function in the browser with this element as the first argument.

Callers 1

typeTextMethod · 0.45

Calls 1

evaluateMethod · 0.80

Tested by

no test coverage detected