@override
(locator)
| 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. |
no test coverage detected