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

Function findFields

lib/helper/WebDriver.js:3073–3096  ·  view source on GitHub ↗
(locator, context = null)

Source from the content-addressed store, hash-verified

3071}
3072
3073async function findFields(locator, context = null) {
3074 const locateFn = prepareLocateFn.call(this, context)
3075 locator = new Locator(locator)
3076
3077 if (this._isCustomLocator(locator)) {
3078 return locateFn(locator)
3079 }
3080
3081 if (locator.isAccessibilityId() && !this.isWeb) return locateFn(locator)
3082 if (locator.isRole()) return locateFn(locator)
3083 if (!locator.isFuzzy()) return locateFn(locator)
3084
3085 const literal = xpathLocator.literal(locator.value)
3086 let els = await locateFn(Locator.field.labelEquals(literal))
3087 if (els.length) return els
3088
3089 els = await locateFn(Locator.field.labelContains(literal))
3090 if (els.length) return els
3091
3092 els = await locateFn(Locator.field.byName(literal))
3093 if (els.length) return els
3094
3095 return await locateFn(locator.value) // by css or xpath
3096}
3097
3098async function proceedSeeField(assertType, field, value, context) {
3099 const res = await findFields.call(this, field, context)

Callers

nothing calls this directly

Calls 4

_isCustomLocatorMethod · 0.80
isAccessibilityIdMethod · 0.80
isRoleMethod · 0.80
isFuzzyMethod · 0.80

Tested by

no test coverage detected