Skip to content

Commit 049761c

Browse files
kamenlitchevp0deje
authored andcommitted
Fix Firefox location detection on Windows_x64
When searching for firefox.exe Selenium would not properly detect its a Firefox x64 installation under 32-bit Ruby on x64 Windows (10?). For Windows x64 with Ruby x86 the current code would always detect only "C:\Program Files (x86)", since both 'PROGRAMFILES' and 'ProgramFiles(x86)' dyanmically map to that value because of the Ruby x86 bitness. Due to that Firefox x64 would not be auto-detected with error "Selenium::WebDriver::Error::WebDriverError: Could not find Firefox binary (os=windows). Make sure Firefox is installed or set the path manually with Selenium::WebDriver::Firefox::Binary.path=". The Firefox x64 executable is actually located under "C:\Program Files' but Selenium would look only under "C:\\Program Files (x86)". The fix is to introduce a new environment variable poll for "ProgramW6432" (https://msdn.microsoft.com/en-us/library/windows/desktop/aa384274(v=vs.85).aspx) which will return the proper "\\Program Files" directory on a Windows x64 machine with Ruby x86. Signed-off-by: Alex Rodionov <[email protected]>
1 parent 5c193e4 commit 049761c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

rb/lib/selenium/webdriver/common/platform.rb

+2-1
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,8 @@ def find_binary(*binary_names)
161161
def find_in_program_files(*binary_names)
162162
paths = [
163163
ENV['PROGRAMFILES'] || '\\Program Files',
164-
ENV['ProgramFiles(x86)'] || '\\Program Files (x86)'
164+
ENV['ProgramFiles(x86)'] || '\\Program Files (x86)',
165+
ENV['ProgramW6432'] || '\\Program Files'
165166
]
166167

167168
paths.each do |root|

0 commit comments

Comments
 (0)