Skip to content

Commit 15f21d7

Browse files
committed
onbehalf of Dominik Ruf
firefox may be installed without admininstrator privileges and therefore there may be no HKEY_LOCAL_MACHINE entry Fixes Issue #7784
1 parent e41d76b commit 15f21d7

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

py/selenium/webdriver/firefox/firefox_binary.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,9 @@ def _wait_until_connectable(self):
112112

113113
def _find_exe_in_registry(self):
114114
try:
115-
from _winreg import OpenKey, QueryValue, HKEY_LOCAL_MACHINE
115+
from _winreg import OpenKey, QueryValue, HKEY_LOCAL_MACHINE, HKEY_CURRENT_USER
116116
except ImportError:
117-
from winreg import OpenKey, QueryValue, HKEY_LOCAL_MACHINE
117+
from winreg import OpenKey, QueryValue, HKEY_LOCAL_MACHINE, HKEY_CURRENT_USER
118118
import shlex
119119
keys = (
120120
r"SOFTWARE\Classes\FirefoxHTML\shell\open\command",
@@ -127,7 +127,12 @@ def _find_exe_in_registry(self):
127127
command = QueryValue(key, "")
128128
break
129129
except OSError:
130-
pass
130+
try:
131+
key = OpenKey(HKEY_CURRENT_USER, path)
132+
command = QueryValue(key, "")
133+
break
134+
except OSError:
135+
pass
131136
else:
132137
return ""
133138

0 commit comments

Comments
 (0)