MCPcopy Index your code
hub / github.com/SeleniumHQ/selenium / findElements

Method findElements

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

@override

(locator)

Source from the content-addressed store, hash-verified

1055
1056 /** @override */
1057 async findElements(locator) {
1058 let cmd = null
1059 if (locator instanceof RelativeBy) {
1060 cmd = new command.Command(command.Name.FIND_ELEMENTS_RELATIVE).setParameter('args', locator.marshall())
1061 } else {
1062 locator = by.checkedLocator(locator)
1063 }
1064
1065 if (typeof locator === 'function') {
1066 return this.findElementsInternal_(locator, this)
1067 } else if (cmd === null) {
1068 cmd = new command.Command(command.Name.FIND_ELEMENTS)
1069 .setParameter('using', locator.using)
1070 .setParameter('value', locator.value)
1071 }
1072 try {
1073 let res = await this.execute(cmd)
1074 return Array.isArray(res) ? res : []
1075 } catch (ex) {
1076 if (ex instanceof error.NoSuchElementError) {
1077 return []
1078 }
1079 throw ex
1080 }
1081 }
1082
1083 /**
1084 * @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