File tree Expand file tree Collapse file tree 1 file changed +23
-3
lines changed
Expand file tree Collapse file tree 1 file changed +23
-3
lines changed Original file line number Diff line number Diff 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 )
You can’t perform that action at this time.
0 commit comments