Skip to content

Commit 63b1e9d

Browse files
committed
fix: mac test webdriver path
1 parent f299dab commit 63b1e9d

File tree

1 file changed

+23
-3
lines changed

1 file changed

+23
-3
lines changed

sample/Tests/test/test_mac.py

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,30 @@ def login(cls):
9696
# Explicitly specify ChromeDriver path and Chrome browser path for macOS
9797
from selenium.webdriver.chrome.service import Service
9898
chromedriver_path = "/usr/local/bin/chromedriver"
99-
chrome_path = "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
10099

101-
# Set Chrome as the browser binary
102-
chrome_options.binary_location = chrome_path
100+
# Try multiple possible Chrome paths on macOS
101+
chrome_paths = [
102+
"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome",
103+
"/System/Applications/Google Chrome.app/Contents/MacOS/Google Chrome",
104+
"/usr/bin/google-chrome",
105+
"/usr/local/bin/google-chrome"
106+
]
107+
108+
import os
109+
chrome_path = None
110+
for path in chrome_paths:
111+
if os.path.exists(path):
112+
chrome_path = path
113+
print(f"Found Chrome at: {chrome_path}")
114+
break
115+
116+
if not chrome_path:
117+
print("Chrome not found at any expected path, letting Selenium auto-detect")
118+
chrome_path = None
119+
120+
# Set Chrome as the browser binary if found
121+
if chrome_path:
122+
chrome_options.binary_location = chrome_path
103123

104124
# Create service with explicit ChromeDriver path
105125
service = Service(executable_path=chromedriver_path)

0 commit comments

Comments
 (0)