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

Method locate

javascript/selenium-webdriver/firefox.js:697–725  ·  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

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

Calls 4

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