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

Method withAttr

lib/locator.js:330–337  ·  view source on GitHub ↗

* @param {Object. } attributes * @returns {Locator}

(attributes)

Source from the content-addressed store, hash-verified

328 * @returns {Locator}
329 */
330 withAttr(attributes) {
331 const operands = []
332 for (const attr of Object.keys(attributes)) {
333 operands.push(`@${attr} = ${xpathLocator.literal(attributes[attr])}`)
334 }
335 const xpath = sprintf('%s[%s]', this.toXPath(), operands.join(' and '))
336 return new Locator({ xpath })
337 }
338
339 /**
340 * Adds condition: attribute value starts with text

Callers 1

locator_test.jsFile · 0.80

Calls 2

toXPathMethod · 0.95
pushMethod · 0.80

Tested by

no test coverage detected