@override
(locator)
| 1005 | |
| 1006 | /** @override */ |
| 1007 | findElement(locator) { |
| 1008 | let id |
| 1009 | let cmd = null |
| 1010 | |
| 1011 | if (locator instanceof RelativeBy) { |
| 1012 | cmd = new command.Command(command.Name.FIND_ELEMENTS_RELATIVE).setParameter('args', locator.marshall()) |
| 1013 | } else { |
| 1014 | locator = by.checkedLocator(locator) |
| 1015 | } |
| 1016 | |
| 1017 | if (typeof locator === 'function') { |
| 1018 | id = this.findElementInternal_(locator, this) |
| 1019 | return new WebElementPromise(this, id) |
| 1020 | } else if (cmd === null) { |
| 1021 | cmd = new command.Command(command.Name.FIND_ELEMENT) |
| 1022 | .setParameter('using', locator.using) |
| 1023 | .setParameter('value', locator.value) |
| 1024 | } |
| 1025 | |
| 1026 | id = this.execute(cmd) |
| 1027 | if (locator instanceof RelativeBy) { |
| 1028 | return this.normalize_(id) |
| 1029 | } else { |
| 1030 | return new WebElementPromise(this, id) |
| 1031 | } |
| 1032 | } |
| 1033 | |
| 1034 | /** |
| 1035 | * @param {!Function} webElementPromise The webElement in unresolved state |
nothing calls this directly
no test coverage detected