Skip to content

Commit e34efef

Browse files
committed
Improve the error message when Chrome is not installed
1 parent d859281 commit e34efef

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

seleniumbase/undetected/__init__.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,9 +214,16 @@ def __init__(
214214
language = "en-US"
215215
options.add_argument("--lang=%s" % language)
216216
if not options.binary_location:
217-
options.binary_location = (
217+
binary_location = (
218218
browser_executable_path or find_chrome_executable()
219219
)
220+
if binary_location:
221+
options.binary_location = binary_location
222+
else:
223+
# Improve the default error message in this situation.
224+
# Setting options.binary_location to None results in:
225+
# "TypeError: Binary Location Must be a String"
226+
raise Exception("Chrome not found! Install it first!")
220227
self._delay = constants.UC.RECONNECT_TIME
221228
self.user_data_dir = user_data_dir
222229
self.keep_user_data_dir = keep_user_data_dir

0 commit comments

Comments
 (0)