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

Method _normalizeLocator

lib/element/WebElement.js:556–571  ·  view source on GitHub ↗
(locator)

Source from the content-addressed store, hash-verified

554 }
555
556 _normalizeLocator(locator) {
557 if (typeof locator === 'string') {
558 return locator
559 }
560
561 if (typeof locator === 'object') {
562 // Handle CodeceptJS locator objects
563 if (locator.css) return locator.css
564 if (locator.xpath) return locator.xpath
565 if (locator.id) return `#${locator.id}`
566 if (locator.name) return `[name="${locator.name}"]`
567 if (locator.className) return `.${locator.className}`
568 }
569
570 return locator.toString()
571 }
572}
573
574export default WebElement

Callers 3

$Method · 0.95
$$Method · 0.95
WebElement_test.jsFile · 0.80

Calls 1

toStringMethod · 0.45

Tested by

no test coverage detected