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

Method getText

lib/element/WebElement.js:49–60  ·  view source on GitHub ↗

* Get text content of the element * @returns {Promise } Element text content

()

Source from the content-addressed store, hash-verified

47 * @returns {Promise<string>} Element text content
48 */
49 async getText() {
50 switch (this.helperType) {
51 case 'playwright':
52 return this.element.textContent()
53 case 'webdriver':
54 return this.element.getText()
55 case 'puppeteer':
56 return this.element.evaluate(el => el.textContent)
57 default:
58 throw new Error(`Unsupported helper type: ${this.helperType}`)
59 }
60 }
61
62 /**
63 * Get attribute value of the element

Callers 5

describeMethod · 0.95
proceedSingleFunction · 0.80
WebElement_test.jsFile · 0.80
els_test.jsFile · 0.80

Calls 1

evaluateMethod · 0.80

Tested by 1

describeMethod · 0.76