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

Method locate

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

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

Calls 3

findInProgramFilesFunction · 0.85
ErrorFunction · 0.85
existsMethod · 0.80