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

Method getAttribute

lib/element/WebElement.js:67–78  ·  view source on GitHub ↗

* Get attribute value of the element * @param {string} name Attribute name * @returns {Promise } Attribute value

(name)

Source from the content-addressed store, hash-verified

65 * @returns {Promise<string|null>} Attribute value
66 */
67 async getAttribute(name) {
68 switch (this.helperType) {
69 case 'playwright':
70 return this.element.getAttribute(name)
71 case 'webdriver':
72 return this.element.getAttribute(name)
73 case 'puppeteer':
74 return this.element.evaluate((el, attrName) => el.getAttribute(attrName), name)
75 default:
76 throw new Error(`Unsupported helper type: ${this.helperType}`)
77 }
78 }
79
80 /**
81 * Get property value of the element

Callers 15

describeMethod · 0.95
checkOptionMethod · 0.80
uncheckOptionMethod · 0.80
grabAttributeFromAllMethod · 0.80
proceedIsCheckedFunction · 0.80
findByRoleFunction · 0.80
proceedSelectFunction · 0.80
grabAttributeFromAllMethod · 0.80
proceedSeeFieldFunction · 0.80

Calls 1

evaluateMethod · 0.80

Tested by 1

describeMethod · 0.76