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