Skip to content

Commit c896d2d

Browse files
authored
[py] Use pinned browsers for bidi webextension tests (#16071)
1 parent e8315e8 commit c896d2d

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

py/test/selenium/webdriver/common/bidi_webextension_tests.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,18 +132,30 @@ def chromium_driver(self, chromium_options, request):
132132

133133
if driver_option == "chrome":
134134
browser_class = webdriver.Chrome
135+
browser_service = webdriver.ChromeService
135136
elif driver_option == "edge":
136137
browser_class = webdriver.Edge
138+
browser_service = webdriver.EdgeService
137139

138-
temp_dir = tempfile.mkdtemp(prefix="chrome-profile-")
140+
temp_dir = tempfile.mkdtemp(prefix="chromium-profile-")
139141

140142
chromium_options.enable_bidi = True
141143
chromium_options.enable_webextensions = True
142144
chromium_options.add_argument(f"--user-data-dir={temp_dir}")
143145
chromium_options.add_argument("--no-sandbox")
144146
chromium_options.add_argument("--disable-dev-shm-usage")
145147

146-
chromium_driver = browser_class(options=chromium_options)
148+
binary = request.config.option.binary
149+
if binary:
150+
chromium_options.binary_location = binary
151+
152+
executable = request.config.option.executable
153+
if executable:
154+
service = browser_service(executable_path=executable)
155+
else:
156+
service = browser_service()
157+
158+
chromium_driver = browser_class(options=chromium_options, service=service)
147159

148160
yield chromium_driver
149161
chromium_driver.quit()

0 commit comments

Comments
 (0)