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

Method findElement

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

@override

(locator)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 4

findElementInternal_Method · 0.95
executeMethod · 0.95
normalize_Method · 0.95
setParameterMethod · 0.80

Tested by

no test coverage detected