MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / findElements

Method findElements

javascript/selenium-webdriver/lib/webdriver.js:1072–1096  ·  view source on GitHub ↗

@override

(locator)

Source from the content-addressed store, hash-verified

1070
1071 /** @override */
1072 async findElements(locator) {
1073 let cmd = null
1074 if (locator instanceof RelativeBy) {
1075 cmd = new command.Command(command.Name.FIND_ELEMENTS_RELATIVE).setParameter('args', locator.marshall())
1076 } else {
1077 locator = by.checkedLocator(locator)
1078 }
1079
1080 if (typeof locator === 'function') {
1081 return this.findElementsInternal_(locator, this)
1082 } else if (cmd === null) {
1083 cmd = new command.Command(command.Name.FIND_ELEMENTS)
1084 .setParameter('using', locator.using)
1085 .setParameter('value', locator.value)
1086 }
1087 try {
1088 let res = await this.execute(cmd)
1089 return Array.isArray(res) ? res : []
1090 } catch (ex) {
1091 if (ex instanceof error.NoSuchElementError) {
1092 return []
1093 }
1094 throw ex
1095 }
1096 }
1097
1098 /**
1099 * @param {!Function} locatorFn The locator function to use.

Callers 1

logMutationEventsMethod · 0.95

Calls 3

findElementsInternal_Method · 0.95
executeMethod · 0.95
setParameterMethod · 0.80

Tested by

no test coverage detected