@@ -150,15 +150,16 @@ def logout_with_controlled_browser():
150150 chrome_options .add_experimental_option ("debuggerAddress" , "localhost:9222" )
151151
152152 try :
153- # Connect to the existing browser instance with explicit ChromeDriver path
153+ # Connect to the existing browser instance with explicit paths
154154 from selenium .webdriver .chrome .service import Service
155155 chromedriver_path = r"C:\Users\WindowsBuildsdkServi\Development\chromedriver-win64\chromedriver-win64\chromedriver.exe"
156+ brave_path = r"C:\Program Files\BraveSoftware\Brave-Browser\Application\brave.exe"
156157
157- import os
158- if os . path . exists ( chromedriver_path ):
159- service = Service ( executable_path = chromedriver_path )
160- else :
161- service = Service () # Let Selenium Manager handle it
158+ # Set Brave as the browser binary
159+ chrome_options . binary_location = brave_path
160+
161+ # Create service with explicit ChromeDriver path
162+ service = Service (executable_path = chromedriver_path )
162163
163164 driver = webdriver .Chrome (service = service , options = chrome_options )
164165 print ("Connected to existing browser for logout" )
@@ -287,8 +288,20 @@ def login():
287288 # (Brave uses Chromium engine so Chrome WebDriver works)
288289 chrome_options = Options ()
289290 chrome_options .add_experimental_option ("debuggerAddress" , "localhost:9222" )
291+
292+ # Explicitly specify ChromeDriver path and Brave browser path
293+ from selenium .webdriver .chrome .service import Service
294+ chromedriver_path = r"C:\Users\WindowsBuildsdkServi\Development\chromedriver-win64\chromedriver-win64\chromedriver.exe"
295+ brave_path = r"C:\Program Files\BraveSoftware\Brave-Browser\Application\brave.exe"
296+
297+ # Set Brave as the browser binary
298+ chrome_options .binary_location = brave_path
299+
300+ # Create service with explicit ChromeDriver path
301+ service = Service (executable_path = chromedriver_path )
302+
290303 # Connect to the existing Brave browser instance
291- driver = webdriver .Chrome (options = chrome_options )
304+ driver = webdriver .Chrome (service = service , options = chrome_options )
292305
293306 # HYBRID APPROACH: Try multi-window detection first (proven to work in CI),
294307 # then fall back to Unity log monitoring if needed
0 commit comments