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

Method findElement

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

@override

(locator)

Source from the content-addressed store, hash-verified

996
997 /** @override */
998 findElement(locator) {
999 let id
1000 let cmd = null
1001
1002 if (locator instanceof RelativeBy) {
1003 cmd = new command.Command(command.Name.FIND_ELEMENTS_RELATIVE).setParameter('args', locator.marshall())
1004 } else {
1005 locator = by.checkedLocator(locator)
1006 }
1007
1008 if (typeof locator === 'function') {
1009 id = this.findElementInternal_(locator, this)
1010 return new WebElementPromise(this, id)
1011 } else if (cmd === null) {
1012 cmd = new command.Command(command.Name.FIND_ELEMENT)
1013 .setParameter('using', locator.using)
1014 .setParameter('value', locator.value)
1015 }
1016
1017 id = this.execute(cmd)
1018 if (locator instanceof RelativeBy) {
1019 return this.normalize_(id)
1020 } else {
1021 return new WebElementPromise(this, id)
1022 }
1023 }
1024
1025 /**
1026 * @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