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

Method locate

javascript/selenium-webdriver/firefox.js:696–724  ·  view source on GitHub ↗

* Attempts to locate the Firefox executable for this release channel. This * will first check the default installation location for the channel before * checking the user's PATH. The returned promise will be rejected if Firefox * can not be found. * * @return {!Promise } A prom

()

Source from the content-addressed store, hash-verified

694 * Firefox executable.
695 */
696 locate() {
697 if (this.found_) {
698 return this.found_
699 }
700
701 let found
702 switch (process.platform) {
703 case 'darwin':
704 found = io.exists(this.darwin_).then((exists) => (exists ? this.darwin_ : io.findInPath('firefox')))
705 break
706
707 case 'win32':
708 found = findInProgramFiles(this.win32_).then((found) => found || io.findInPath('firefox.exe'))
709 break
710
711 default:
712 found = Promise.resolve(io.findInPath('firefox'))
713 break
714 }
715
716 this.found_ = found.then((found) => {
717 if (found) {
718 // TODO: verify version info.
719 return found
720 }
721 throw Error('Could not locate Firefox on the current system')
722 })
723 return this.found_
724 }
725
726 /** @return {!Promise<string>} */
727 [Symbols.serialize]() {

Calls 4

findInProgramFilesFunction · 0.85
existsMethod · 0.80
ErrorFunction · 0.50
resolveMethod · 0.45