Skip to content

Commit

Permalink
onbehalf of Dominik Ruf
Browse files Browse the repository at this point in the history
firefox may be installed without admininstrator privileges
and therefore there may be no HKEY_LOCAL_MACHINE entry

Fixes Issue SeleniumHQ#7784
  • Loading branch information
lukeis committed Sep 8, 2014
1 parent e41d76b commit 15f21d7
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions py/selenium/webdriver/firefox/firefox_binary.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,9 @@ def _wait_until_connectable(self):

def _find_exe_in_registry(self):
try:
from _winreg import OpenKey, QueryValue, HKEY_LOCAL_MACHINE
from _winreg import OpenKey, QueryValue, HKEY_LOCAL_MACHINE, HKEY_CURRENT_USER
except ImportError:
from winreg import OpenKey, QueryValue, HKEY_LOCAL_MACHINE
from winreg import OpenKey, QueryValue, HKEY_LOCAL_MACHINE, HKEY_CURRENT_USER
import shlex
keys = (
r"SOFTWARE\Classes\FirefoxHTML\shell\open\command",
Expand All @@ -127,7 +127,12 @@ def _find_exe_in_registry(self):
command = QueryValue(key, "")
break
except OSError:
pass
try:
key = OpenKey(HKEY_CURRENT_USER, path)
command = QueryValue(key, "")
break
except OSError:
pass
else:
return ""

Expand Down

0 comments on commit 15f21d7

Please sign in to comment.