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

Method locate

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

724 * Firefox executable.
725 */
726 locate() {
727 if (this.found_) {
728 return this.found_
729 }
730
731 let found
732 switch (process.platform) {
733 case 'darwin':
734 found = io.exists(this.darwin_).then((exists) => (exists ? this.darwin_ : io.findInPath('firefox')))
735 break
736
737 case 'win32':
738 found = findInProgramFiles(this.win32_).then((found) => found || io.findInPath('firefox.exe'))
739 break
740
741 default:
742 found = Promise.resolve(io.findInPath('firefox'))
743 break
744 }
745
746 this.found_ = found.then((found) => {
747 if (found) {
748 // TODO: verify version info.
749 return found
750 }
751 throw Error('Could not locate Firefox on the current system')
752 })
753 return this.found_
754 }
755
756 /** @return {!Promise<string>} */
757 [Symbols.serialize]() {

Calls 4

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