seleniumbase 4.43.1__py3-none-any.whl → 4.43.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of seleniumbase might be problematic. Click here for more details.

Files changed (35) hide show
  1. seleniumbase/__version__.py +1 -1
  2. seleniumbase/behave/behave_sb.py +7 -7
  3. seleniumbase/console_scripts/sb_caseplans.py +3 -3
  4. seleniumbase/console_scripts/sb_mkchart.py +1 -1
  5. seleniumbase/console_scripts/sb_mkdir.py +21 -21
  6. seleniumbase/console_scripts/sb_mkfile.py +1 -1
  7. seleniumbase/console_scripts/sb_mkpres.py +1 -1
  8. seleniumbase/console_scripts/sb_mkrec.py +1 -1
  9. seleniumbase/console_scripts/sb_objectify.py +4 -4
  10. seleniumbase/console_scripts/sb_print.py +1 -1
  11. seleniumbase/core/browser_launcher.py +14 -1
  12. seleniumbase/core/detect_b_ver.py +214 -8
  13. seleniumbase/core/log_helper.py +4 -4
  14. seleniumbase/core/report_helper.py +6 -4
  15. seleniumbase/core/sb_cdp.py +17 -1
  16. seleniumbase/core/tour_helper.py +1 -1
  17. seleniumbase/fixtures/constants.py +11 -0
  18. seleniumbase/fixtures/js_utils.py +14 -2
  19. seleniumbase/fixtures/page_utils.py +13 -7
  20. seleniumbase/plugins/basic_test_info.py +2 -2
  21. seleniumbase/plugins/page_source.py +2 -2
  22. seleniumbase/plugins/pytest_plugin.py +23 -19
  23. seleniumbase/translate/translator.py +2 -2
  24. seleniumbase/undetected/cdp_driver/cdp_util.py +42 -38
  25. seleniumbase/undetected/cdp_driver/connection.py +1 -0
  26. seleniumbase/utilities/selenium_grid/download_selenium_server.py +1 -1
  27. seleniumbase/utilities/selenium_grid/grid_hub.py +1 -1
  28. seleniumbase/utilities/selenium_grid/grid_node.py +2 -2
  29. seleniumbase/utilities/selenium_ide/convert_ide.py +2 -2
  30. {seleniumbase-4.43.1.dist-info → seleniumbase-4.43.2.dist-info}/METADATA +2 -2
  31. {seleniumbase-4.43.1.dist-info → seleniumbase-4.43.2.dist-info}/RECORD +35 -35
  32. {seleniumbase-4.43.1.dist-info → seleniumbase-4.43.2.dist-info}/WHEEL +0 -0
  33. {seleniumbase-4.43.1.dist-info → seleniumbase-4.43.2.dist-info}/entry_points.txt +0 -0
  34. {seleniumbase-4.43.1.dist-info → seleniumbase-4.43.2.dist-info}/licenses/LICENSE +0 -0
  35. {seleniumbase-4.43.1.dist-info → seleniumbase-4.43.2.dist-info}/top_level.txt +0 -0
@@ -36,7 +36,7 @@ def log_screenshot(test_logpath, driver, screenshot=None, get=False):
36
36
  element = driver.find_element("tag name", "body")
37
37
  screenshot = element.screenshot_as_base64
38
38
  if screenshot != screenshot_warning:
39
- with open(screenshot_path, "wb") as file:
39
+ with open(screenshot_path, mode="wb") as file:
40
40
  file.write(screenshot)
41
41
  with suppress(Exception):
42
42
  shared_utils.make_writable(screenshot_path)
@@ -297,7 +297,7 @@ def log_test_failure_data(test, test_logpath, driver, browser, url=None):
297
297
  with suppress(Exception):
298
298
  os.makedirs(test_logpath)
299
299
  with suppress(Exception):
300
- log_file = open(basic_file_path, "w+", encoding="utf-8")
300
+ log_file = open(basic_file_path, mode="w+", encoding="utf-8")
301
301
  log_file.writelines("\r\n".join(data_to_save))
302
302
  log_file.close()
303
303
  shared_utils.make_writable(basic_file_path)
@@ -352,7 +352,7 @@ def log_skipped_test_data(test, test_logpath, driver, browser, reason):
352
352
  data_to_save.append("")
353
353
  file_path = os.path.join(test_logpath, "skip_reason.txt")
354
354
  with suppress(Exception):
355
- log_file = open(file_path, "w+", encoding="utf-8")
355
+ log_file = open(file_path, mode="w+", encoding="utf-8")
356
356
  log_file.writelines("\r\n".join(data_to_save))
357
357
  log_file.close()
358
358
  shared_utils.make_writable(file_path)
@@ -387,7 +387,7 @@ def log_page_source(test_logpath, driver, source=None):
387
387
  os.makedirs(test_logpath)
388
388
  html_file_path = os.path.join(test_logpath, html_file_name)
389
389
  with suppress(Exception):
390
- html_file = open(html_file_path, "w+", encoding="utf-8")
390
+ html_file = open(html_file_path, mode="w+", encoding="utf-8")
391
391
  html_file.write(page_source)
392
392
  html_file.close()
393
393
  shared_utils.make_writable(html_file_path)
@@ -47,7 +47,9 @@ def save_test_failure_data(test, name, folder=None):
47
47
  failure_data_file_path = os.path.join(file_path, name)
48
48
  else:
49
49
  failure_data_file_path = name
50
- failure_data_file = open(failure_data_file_path, "w+", "utf-8")
50
+ failure_data_file = open(
51
+ failure_data_file_path, mode="w+", encoding="utf-8"
52
+ )
51
53
  data_to_save = []
52
54
  if not hasattr(sb_config, "_report_test_id"):
53
55
  exc_message = "(Unknown Exception)"
@@ -99,7 +101,7 @@ def process_failures(test, test_count, duration):
99
101
  bad_page_data = "failure_%s.txt" % test_count
100
102
  screenshot_path = os.path.join(LATEST_REPORT_DIR, bad_page_image)
101
103
  if hasattr(test, "_last_page_screenshot") and test._last_page_screenshot:
102
- with open(screenshot_path, "wb") as file:
104
+ with open(screenshot_path, mode="wb") as file:
103
105
  file.write(test._last_page_screenshot)
104
106
  save_test_failure_data(test, bad_page_data, folder=LATEST_REPORT_DIR)
105
107
  exc_message = None
@@ -172,7 +174,7 @@ def add_bad_page_log_file(page_results_list):
172
174
  abs_path = os.path.abspath(".")
173
175
  file_path = os.path.join(abs_path, LATEST_REPORT_DIR)
174
176
  log_file = os.path.join(file_path, RESULTS_TABLE)
175
- f = open(log_file, "w")
177
+ f = open(log_file, mode="w")
176
178
  h_p1 = '"Num","Result","Stacktrace","Screenshot",'
177
179
  h_p2 = '"URL","Browser","Epoch Time","Duration",'
178
180
  h_p3 = '"Test Case Address","Additional Info"\n'
@@ -197,7 +199,7 @@ def add_results_page(html):
197
199
  file_path = os.path.join(abs_path, LATEST_REPORT_DIR)
198
200
  results_file_name = HTML_REPORT
199
201
  results_file = os.path.join(file_path, results_file_name)
200
- f = open(results_file, "w")
202
+ f = open(results_file, mode="w")
201
203
  f.write(html)
202
204
  f.close()
203
205
  return results_file
@@ -1674,6 +1674,11 @@ class CDPMethods():
1674
1674
  import pyautogui
1675
1675
  pyautogui = self.__get_configured_pyautogui(pyautogui)
1676
1676
  screen_width, screen_height = pyautogui.size()
1677
+ if (
1678
+ hasattr(sb_config, "_cdp_browser")
1679
+ and sb_config._cdp_browser == "opera"
1680
+ ):
1681
+ x = x + 55
1677
1682
  if x < 0 or y < 0 or x > screen_width or y > screen_height:
1678
1683
  raise Exception(
1679
1684
  "PyAutoGUI cannot click on point (%s, %s)"
@@ -1931,6 +1936,12 @@ class CDPMethods():
1931
1936
  import pyautogui
1932
1937
  pyautogui = self.__get_configured_pyautogui(pyautogui)
1933
1938
  screen_width, screen_height = pyautogui.size()
1939
+ if (
1940
+ hasattr(sb_config, "_cdp_browser")
1941
+ and sb_config._cdp_browser == "opera"
1942
+ ):
1943
+ x1 = x1 + 55
1944
+ x2 = x2 + 55
1934
1945
  if x1 < 0 or y1 < 0 or x1 > screen_width or y1 > screen_height:
1935
1946
  raise Exception(
1936
1947
  "PyAutoGUI cannot drag-drop from point (%s, %s)"
@@ -2022,6 +2033,11 @@ class CDPMethods():
2022
2033
  import pyautogui
2023
2034
  pyautogui = self.__get_configured_pyautogui(pyautogui)
2024
2035
  screen_width, screen_height = pyautogui.size()
2036
+ if (
2037
+ hasattr(sb_config, "_cdp_browser")
2038
+ and sb_config._cdp_browser == "opera"
2039
+ ):
2040
+ x = x + 55
2025
2041
  if x < 0 or y < 0 or x > screen_width or y > screen_height:
2026
2042
  raise Exception(
2027
2043
  "PyAutoGUI cannot hover on point (%s, %s)"
@@ -2694,7 +2710,7 @@ class CDPMethods():
2694
2710
  rendered_source = "%s\n%s" % (base_href_html, page_source)
2695
2711
  else:
2696
2712
  rendered_source = page_source
2697
- html_file = open(html_file_path, "w+", "utf-8")
2713
+ html_file = open(html_file_path, mode="w+", encoding="utf-8")
2698
2714
  html_file.write(rendered_source)
2699
2715
  html_file.close()
2700
2716
 
@@ -1136,7 +1136,7 @@ def export_tour(tour_steps, name=None, filename="my_tour.js", url=None):
1136
1136
  pass
1137
1137
 
1138
1138
  file_path = exported_tours_folder + "/" + filename
1139
- out_file = open(file_path, "w+", encoding="utf-8")
1139
+ out_file = open(file_path, mode="w+", encoding="utf-8")
1140
1140
  out_file.writelines(instructions)
1141
1141
  out_file.close()
1142
1142
  print("\n>>> [%s] was saved!\n" % file_path)
@@ -406,7 +406,14 @@ class ValidBinaries:
406
406
  "brave",
407
407
  "opera",
408
408
  "opera-stable",
409
+ "comet",
410
+ "comet-browser",
411
+ "comet-stable",
412
+ "atlas",
413
+ "atlas-browser",
414
+ "atlas-stable",
409
415
  "chrome.exe", # WSL (Windows Subsystem for Linux)
416
+ "chromium.exe", # WSL (Windows Subsystem for Linux)
410
417
  ]
411
418
  valid_edge_binaries_on_linux = [
412
419
  "microsoft-edge",
@@ -424,6 +431,8 @@ class ValidBinaries:
424
431
  "Google Chrome Dev",
425
432
  "Brave Browser",
426
433
  "Opera",
434
+ "Comet",
435
+ "Atlas",
427
436
  ]
428
437
  valid_edge_binaries_on_macos = [
429
438
  "Microsoft Edge",
@@ -434,6 +443,8 @@ class ValidBinaries:
434
443
  "chrome-headless-shell.exe",
435
444
  "brave.exe",
436
445
  "opera.exe",
446
+ "comet.exe",
447
+ "atlas.exe",
437
448
  ]
438
449
  valid_edge_binaries_on_windows = [
439
450
  "msedge.exe",
@@ -1269,10 +1269,16 @@ def scroll_to_element(driver, element):
1269
1269
  return False
1270
1270
  try:
1271
1271
  element_location_x = element.location["x"]
1272
+ except Exception:
1273
+ element_location_x = 0
1274
+ try:
1272
1275
  element_width = element.size["width"]
1276
+ except Exception:
1277
+ element_width = 0
1278
+ try:
1273
1279
  screen_width = driver.get_window_size()["width"]
1274
1280
  except Exception:
1275
- element_location_x = 0
1281
+ screen_width = execute_script("return window.innerWidth;")
1276
1282
  element_location_y = element_location_y - constants.Scroll.Y_OFFSET
1277
1283
  if element_location_y < 0:
1278
1284
  element_location_y = 0
@@ -1312,10 +1318,16 @@ def slow_scroll_to_element(driver, element, *args, **kwargs):
1312
1318
  return
1313
1319
  try:
1314
1320
  element_location_x = element.location["x"]
1321
+ except Exception:
1322
+ element_location_x = 0
1323
+ try:
1315
1324
  element_width = element.size["width"]
1325
+ except Exception:
1326
+ element_width = 0
1327
+ try:
1316
1328
  screen_width = driver.get_window_size()["width"]
1317
1329
  except Exception:
1318
- element_location_x = 0
1330
+ screen_width = execute_script("return window.innerWidth;")
1319
1331
  element_location_y = element_location_y - constants.Scroll.Y_OFFSET
1320
1332
  if element_location_y < 0:
1321
1333
  element_location_y = 0
@@ -109,10 +109,10 @@ def looks_like_a_page_url(url):
109
109
  navigate to the page if a URL is detected, but will instead call
110
110
  self.get_element(URL_AS_A_SELECTOR) if the input is not a URL."""
111
111
  return url.startswith((
112
- "http:", "https:", "://", "about:", "blob:", "chrome:",
112
+ "http:", "https:", "://", "about:", "blob:", "chrome:", "opera:",
113
113
  "data:", "edge:", "file:", "view-source:", "chrome-search:",
114
114
  "chrome-extension:", "chrome-untrusted:", "isolated-app:",
115
- "chrome-devtools:", "devtools:"
115
+ "chrome-devtools:", "devtools:", "brave:", "comet:", "atlas:"
116
116
  ))
117
117
 
118
118
 
@@ -304,7 +304,7 @@ def _download_file_to(file_url, destination_folder, new_file_name=None):
304
304
  constants.MultiBrowser.DOWNLOAD_FILE_LOCK
305
305
  )
306
306
  with download_file_lock:
307
- with open(file_path, "wb") as code:
307
+ with open(file_path, mode="wb") as code:
308
308
  code.write(r.content)
309
309
 
310
310
 
@@ -314,7 +314,9 @@ def _save_data_as(data, destination_folder, file_name):
314
314
  )
315
315
  with file_io_lock:
316
316
  out_file = open(
317
- os.path.join(destination_folder, file_name), "w+", encoding="utf-8"
317
+ os.path.join(destination_folder, file_name),
318
+ mode="w+",
319
+ encoding="utf-8",
318
320
  )
319
321
  out_file.writelines(data)
320
322
  out_file.close()
@@ -327,12 +329,16 @@ def _append_data_to_file(data, destination_folder, file_name):
327
329
  with file_io_lock:
328
330
  existing_data = ""
329
331
  if os.path.exists(os.path.join(destination_folder, file_name)):
330
- with open(os.path.join(destination_folder, file_name), "r") as f:
332
+ with open(
333
+ os.path.join(destination_folder, file_name), mode="r"
334
+ ) as f:
331
335
  existing_data = f.read()
332
336
  if not existing_data.split("\n")[-1] == "":
333
337
  existing_data += "\n"
334
338
  out_file = open(
335
- os.path.join(destination_folder, file_name), "w+", encoding="utf-8"
339
+ os.path.join(destination_folder, file_name),
340
+ mode="w+",
341
+ encoding="utf-8",
336
342
  )
337
343
  out_file.writelines("%s%s" % (existing_data, data))
338
344
  out_file.close()
@@ -345,7 +351,7 @@ def _get_file_data(folder, file_name):
345
351
  with file_io_lock:
346
352
  if not os.path.exists(os.path.join(folder, file_name)):
347
353
  raise Exception("File not found!")
348
- with open(os.path.join(folder, file_name), "r") as f:
354
+ with open(os.path.join(folder, file_name), mode="r") as f:
349
355
  data = f.read()
350
356
  return data
351
357
 
@@ -25,7 +25,7 @@ class BasicTestInfo(Plugin):
25
25
  if not os.path.exists(test_logpath):
26
26
  os.makedirs(test_logpath)
27
27
  file_name = "%s/%s" % (test_logpath, self.logfile_name)
28
- basic_info_file = open(file_name, "w+", "utf-8")
28
+ basic_info_file = open(file_name, mode="w+", encoding="utf-8")
29
29
  self.__log_test_error_data(basic_info_file, test, err, "Error")
30
30
  basic_info_file.close()
31
31
 
@@ -34,7 +34,7 @@ class BasicTestInfo(Plugin):
34
34
  if not os.path.exists(test_logpath):
35
35
  os.makedirs(test_logpath)
36
36
  file_name = "%s/%s" % (test_logpath, self.logfile_name)
37
- basic_info_file = open(file_name, "w+", "utf-8")
37
+ basic_info_file = open(file_name, mode="w+", encoding="utf-8")
38
38
  self.__log_test_error_data(basic_info_file, test, err, "Error")
39
39
  basic_info_file.close()
40
40
 
@@ -28,7 +28,7 @@ class PageSource(Plugin):
28
28
  if not os.path.exists(test_logpath):
29
29
  os.makedirs(test_logpath)
30
30
  html_file_name = os.path.join(test_logpath, self.logfile_name)
31
- html_file = open(html_file_name, "w+", "utf-8")
31
+ html_file = open(html_file_name, mode="w+", encoding="utf-8")
32
32
  rendered_source = log_helper.get_html_source_with_base_href(
33
33
  test.driver, page_source
34
34
  )
@@ -44,7 +44,7 @@ class PageSource(Plugin):
44
44
  if not os.path.exists(test_logpath):
45
45
  os.makedirs(test_logpath)
46
46
  html_file_name = os.path.join(test_logpath, self.logfile_name)
47
- html_file = open(html_file_name, "w+", "utf-8")
47
+ html_file = open(html_file_name, mode="w+", encoding="utf-8")
48
48
  rendered_source = log_helper.get_html_source_with_base_href(
49
49
  test.driver, page_source
50
50
  )
@@ -1910,24 +1910,24 @@ def _create_dashboard_assets_():
1910
1910
  add_pytest_style_css = True
1911
1911
  if os.path.exists(pytest_style_css):
1912
1912
  existing_pytest_style = None
1913
- with open(pytest_style_css, "r") as f:
1913
+ with open(pytest_style_css, mode="r") as f:
1914
1914
  existing_pytest_style = f.read()
1915
1915
  if existing_pytest_style == get_pytest_style():
1916
1916
  add_pytest_style_css = False
1917
1917
  if add_pytest_style_css:
1918
- out_file = open(pytest_style_css, "w+", encoding="utf-8")
1918
+ out_file = open(pytest_style_css, mode="w+", encoding="utf-8")
1919
1919
  out_file.writelines(get_pytest_style())
1920
1920
  out_file.close()
1921
1921
  live_js_file = os.path.join(assets_folder, "live.js")
1922
1922
  add_live_js_file = True
1923
1923
  if os.path.exists(live_js_file):
1924
1924
  existing_live_js = None
1925
- with open(live_js_file, "r") as f:
1925
+ with open(live_js_file, mode="r") as f:
1926
1926
  existing_live_js = f.read()
1927
1927
  if existing_live_js == live_js:
1928
1928
  add_live_js_file = False
1929
1929
  if add_live_js_file:
1930
- out_file = open(live_js_file, "w+", encoding="utf-8")
1930
+ out_file = open(live_js_file, mode="w+", encoding="utf-8")
1931
1931
  out_file.writelines(live_js)
1932
1932
  out_file.close()
1933
1933
 
@@ -2228,7 +2228,7 @@ def _perform_pytest_unconfigure_(config):
2228
2228
  and html_report_path
2229
2229
  and os.path.exists(html_report_path)
2230
2230
  ):
2231
- with open(html_report_path, "r", encoding="utf-8") as f:
2231
+ with open(html_report_path, mode="r", encoding="utf-8") as f:
2232
2232
  the_html_r = f.read()
2233
2233
  assets_chunk = "if (assets.length === 1) {"
2234
2234
  remove_media = "container.classList.remove('media-container')"
@@ -2274,18 +2274,18 @@ def _perform_pytest_unconfigure_(config):
2274
2274
  the_html_r = (
2275
2275
  the_html_r[:rc_loc] + new_time + the_html_r[end_rc_loc:]
2276
2276
  )
2277
- with open(html_report_path, "w", encoding="utf-8") as f:
2277
+ with open(html_report_path, mode="w", encoding="utf-8") as f:
2278
2278
  f.write(the_html_r) # Finalize the HTML report
2279
2279
  with suppress(Exception):
2280
2280
  shared_utils.make_writable(html_report_path)
2281
- with open(html_report_path_copy, "w", encoding="utf-8") as f:
2281
+ with open(html_report_path_copy, mode="w", encoding="utf-8") as f:
2282
2282
  f.write(the_html_r) # Finalize the HTML report copy
2283
2283
  with suppress(Exception):
2284
2284
  shared_utils.make_writable(html_report_path_copy)
2285
2285
  assets_style = "./assets/style.css"
2286
2286
  if os.path.exists(assets_style):
2287
2287
  html_style = None
2288
- with open(assets_style, "r", encoding="utf-8") as f:
2288
+ with open(assets_style, mode="r", encoding="utf-8") as f:
2289
2289
  html_style = f.read()
2290
2290
  if html_style:
2291
2291
  html_style = html_style.replace("top: -50px;", "top: 2px;")
@@ -2297,7 +2297,7 @@ def _perform_pytest_unconfigure_(config):
2297
2297
  html_style = html_style.replace(".collapsible", ".oldc")
2298
2298
  html_style = html_style.replace(" (hide details)", "")
2299
2299
  html_style = html_style.replace(" (show details)", "")
2300
- with open(assets_style, "w", encoding="utf-8") as f:
2300
+ with open(assets_style, mode="w", encoding="utf-8") as f:
2301
2301
  f.write(html_style)
2302
2302
  with suppress(Exception):
2303
2303
  shared_utils.make_writable(assets_style)
@@ -2332,7 +2332,7 @@ def _perform_pytest_unconfigure_(config):
2332
2332
  # Part 1: Finalizing the dashboard / integrating html report
2333
2333
  if os.path.exists(dashboard_path):
2334
2334
  the_html_d = None
2335
- with open(dashboard_path, "r", encoding="utf-8") as f:
2335
+ with open(dashboard_path, mode="r", encoding="utf-8") as f:
2336
2336
  the_html_d = f.read()
2337
2337
  if sb_config._multithreaded and "-c" in sys_argv:
2338
2338
  # Threads have "-c" in sys.argv, except for the last
@@ -2343,7 +2343,7 @@ def _perform_pytest_unconfigure_(config):
2343
2343
  if os.path.exists(pie_path):
2344
2344
  import json
2345
2345
 
2346
- with open(pie_path, "r") as f:
2346
+ with open(pie_path, mode="r") as f:
2347
2347
  dash_pie = f.read().strip()
2348
2348
  sb_config._saved_dashboard_pie = json.loads(dash_pie)
2349
2349
  # If the test run doesn't complete by itself, stop refresh
@@ -2374,20 +2374,20 @@ def _perform_pytest_unconfigure_(config):
2374
2374
  if sb_config._dash_final_summary:
2375
2375
  the_html_d += sb_config._dash_final_summary
2376
2376
  time.sleep(0.1) # Add time for "livejs" to detect changes
2377
- with open(dashboard_path, "w", encoding="utf-8") as f:
2377
+ with open(dashboard_path, mode="w", encoding="utf-8") as f:
2378
2378
  f.write(the_html_d) # Finalize the dashboard
2379
2379
  time.sleep(0.1) # Add time for "livejs" to detect changes
2380
2380
  the_html_d = the_html_d.replace(
2381
2381
  "</head>", "</head><!-- Dashboard Report Done -->"
2382
2382
  )
2383
- with open(dashboard_path, "w", encoding="utf-8") as f:
2383
+ with open(dashboard_path, mode="w", encoding="utf-8") as f:
2384
2384
  f.write(the_html_d) # Finalize the dashboard
2385
2385
  with suppress(Exception):
2386
2386
  shared_utils.make_writable(dashboard_path)
2387
2387
  assets_style = "./assets/style.css"
2388
2388
  if os.path.exists(assets_style):
2389
2389
  html_style = None
2390
- with open(assets_style, "r", encoding="utf-8") as f:
2390
+ with open(assets_style, mode="r", encoding="utf-8") as f:
2391
2391
  html_style = f.read()
2392
2392
  if html_style:
2393
2393
  html_style = html_style.replace("top: -50px;", "top: 2px;")
@@ -2399,7 +2399,7 @@ def _perform_pytest_unconfigure_(config):
2399
2399
  html_style = html_style.replace(".collapsible", ".oldc")
2400
2400
  html_style = html_style.replace(" (hide details)", "")
2401
2401
  html_style = html_style.replace(" (show details)", "")
2402
- with open(assets_style, "w", encoding="utf-8") as f:
2402
+ with open(assets_style, mode="w", encoding="utf-8") as f:
2403
2403
  f.write(html_style)
2404
2404
  with suppress(Exception):
2405
2405
  shared_utils.make_writable(assets_style)
@@ -2421,7 +2421,7 @@ def _perform_pytest_unconfigure_(config):
2421
2421
  ):
2422
2422
  # Add the dashboard pie to the pytest html report
2423
2423
  the_html_r = None
2424
- with open(html_report_path, "r", encoding="utf-8") as f:
2424
+ with open(html_report_path, mode="r", encoding="utf-8") as f:
2425
2425
  the_html_r = f.read()
2426
2426
  if sb_config._saved_dashboard_pie:
2427
2427
  h_r_name = sb_config._html_report_name
@@ -2484,11 +2484,13 @@ def _perform_pytest_unconfigure_(config):
2484
2484
  the_html_r = (
2485
2485
  the_html_r[:rc_loc] + new_time + the_html_r[end_rc_loc:]
2486
2486
  )
2487
- with open(html_report_path, "w", encoding="utf-8") as f:
2487
+ with open(html_report_path, mode="w", encoding="utf-8") as f:
2488
2488
  f.write(the_html_r) # Finalize the HTML report
2489
2489
  with suppress(Exception):
2490
2490
  shared_utils.make_writable(html_report_path)
2491
- with open(html_report_path_copy, "w", encoding="utf-8") as f:
2491
+ with open(
2492
+ html_report_path_copy, mode="w", encoding="utf-8"
2493
+ ) as f:
2492
2494
  f.write(the_html_r) # Finalize the HTML report copy
2493
2495
  with suppress(Exception):
2494
2496
  shared_utils.make_writable(html_report_path_copy)
@@ -2533,7 +2535,9 @@ def pytest_unconfigure(config):
2533
2535
  ):
2534
2536
  # Dash is HTML Report (Multithreaded)
2535
2537
  sb_config._dash_is_html_report = True
2536
- with open(dashboard_path, "w", encoding="utf-8") as f:
2538
+ with open(
2539
+ dashboard_path, mode="w", encoding="utf-8"
2540
+ ) as f:
2537
2541
  f.write(sb_config._dash_html)
2538
2542
  # Dashboard Multithreaded
2539
2543
  _perform_pytest_unconfigure_(config)
@@ -484,7 +484,7 @@ def main():
484
484
  print("")
485
485
  raise Exception(message)
486
486
 
487
- with open(seleniumbase_file, "r", encoding="utf-8") as f:
487
+ with open(seleniumbase_file, mode="r", encoding="utf-8") as f:
488
488
  all_code = f.read()
489
489
  if "def test_" not in all_code and "from seleniumbase" not in all_code:
490
490
  print("")
@@ -1042,7 +1042,7 @@ def main():
1042
1042
  pass # Print-only run already done
1043
1043
 
1044
1044
  if new_file_name:
1045
- out_file = open(new_file_name, "w+", encoding="utf-8")
1045
+ out_file = open(new_file_name, mode="w+", encoding="utf-8")
1046
1046
  out_file.writelines("\r\n".join(seleniumbase_lines))
1047
1047
  out_file.close()
1048
1048
  results_saved = (
@@ -554,11 +554,45 @@ async def start(
554
554
  ad_block_dir = os.path.join(DOWNLOADS_FOLDER, "ad_block")
555
555
  __unzip_to_new_folder(ad_block_zip, ad_block_dir)
556
556
  extension_dir = __add_chrome_ext_dir(extension_dir, ad_block_dir)
557
- if (
558
- "binary_location" in kwargs
559
- and not browser_executable_path
560
- ):
557
+ if "binary_location" in kwargs and not browser_executable_path:
561
558
  browser_executable_path = kwargs["binary_location"]
559
+ if not browser_executable_path:
560
+ browser = None
561
+ if "browser" in kwargs:
562
+ browser = kwargs["browser"]
563
+ if not browser and "--browser" in arg_join:
564
+ br_string = None
565
+ if "--browser=" in arg_join:
566
+ br_string = arg_join.split("--browser=")[1].split(" ")[0]
567
+ elif "--browser " in arg_join:
568
+ br_string = arg_join.split("--browser ")[1].split(" ")[0]
569
+ if br_string:
570
+ if br_string.startswith('"') and br_string.endswith('"'):
571
+ br_string = proxy_string[1:-1]
572
+ elif br_string.startswith("'") and br_string.endswith("'"):
573
+ br_string = proxy_string[1:-1]
574
+ browser = br_string
575
+ if not browser:
576
+ if "--edge" in sys_argv:
577
+ browser = "edge"
578
+ elif "--opera" in sys_argv:
579
+ browser = "opera"
580
+ elif "--brave" in sys_argv:
581
+ browser = "brave"
582
+ elif "--comet" in sys_argv:
583
+ browser = "comet"
584
+ elif "--atlas" in sys_argv:
585
+ browser = "atlas"
586
+ else:
587
+ browser = "chrome"
588
+ sb_config._cdp_browser = browser
589
+ if browser == "comet" or browser == "atlas":
590
+ incognito = False
591
+ guest = False
592
+ with suppress(Exception):
593
+ browser_binary = detect_b_ver.get_binary_location(browser)
594
+ if browser_binary and os.path.exists(browser_binary):
595
+ browser_executable_path = browser_binary
562
596
  if not config:
563
597
  config = Config(
564
598
  user_data_dir,
@@ -622,23 +656,8 @@ async def start(
622
656
 
623
657
 
624
658
  async def start_async(*args, **kwargs) -> Browser:
625
- headless = False
626
- binary_location = None
627
- if "browser_executable_path" in kwargs:
628
- binary_location = kwargs["browser_executable_path"]
629
- if binary_location and isinstance(binary_location, str):
630
- binary_location = binary_location.strip()
631
- else:
632
- binary_location = detect_b_ver.get_binary_location("google-chrome")
633
- if binary_location and isinstance(binary_location, str):
634
- binary_location = binary_location.strip()
635
- if not os.path.exists(binary_location):
636
- binary_location = None
637
- if (
638
- shared_utils.is_chrome_130_or_newer(binary_location)
639
- and "user_data_dir" in kwargs
640
- and kwargs["user_data_dir"]
641
- ):
659
+ if "user_data_dir" in kwargs and kwargs["user_data_dir"]:
660
+ headless = False
642
661
  if "headless" in kwargs:
643
662
  headless = kwargs["headless"]
644
663
  decoy_args = kwargs
@@ -662,23 +681,8 @@ def start_sync(*args, **kwargs) -> Browser:
662
681
  loop = kwargs["loop"]
663
682
  else:
664
683
  loop = asyncio.new_event_loop()
665
- headless = False
666
- binary_location = None
667
- if "browser_executable_path" in kwargs:
668
- binary_location = kwargs["browser_executable_path"]
669
- if binary_location and isinstance(binary_location, str):
670
- binary_location = binary_location.strip()
671
- else:
672
- binary_location = detect_b_ver.get_binary_location("google-chrome")
673
- if binary_location and isinstance(binary_location, str):
674
- binary_location = binary_location.strip()
675
- if not os.path.exists(binary_location):
676
- binary_location = None
677
- if (
678
- shared_utils.is_chrome_130_or_newer(binary_location)
679
- and "user_data_dir" in kwargs
680
- and kwargs["user_data_dir"]
681
- ):
684
+ if "user_data_dir" in kwargs and kwargs["user_data_dir"]:
685
+ headless = False
682
686
  if "headless" in kwargs:
683
687
  headless = kwargs["headless"]
684
688
  decoy_args = kwargs
@@ -33,6 +33,7 @@ GLOBAL_DELAY = 0.005
33
33
  MAX_SIZE: int = 2**28
34
34
  PING_TIMEOUT: int = 1800 # 30 minutes
35
35
  TargetType = Union[cdp.target.TargetInfo, cdp.target.TargetID]
36
+ logging.getLogger("asyncio").setLevel(logging.CRITICAL)
36
37
  logger = logging.getLogger("uc.connection")
37
38
 
38
39
 
@@ -19,7 +19,7 @@ FULL_DOWNLOAD_PATH = os.getcwd() + "/" + RENAMED_JAR_FILE
19
19
  def download_selenium_server():
20
20
  """Downloads the Selenium Server JAR file."""
21
21
  try:
22
- local_file = open(JAR_FILE, "wb")
22
+ local_file = open(JAR_FILE, mode="wb")
23
23
  remote_file = urlopen(SELENIUM_JAR)
24
24
  print("Downloading the Selenium Server JAR file...\n")
25
25
  local_file.write(remote_file.read())
@@ -77,7 +77,7 @@ def main():
77
77
  data = []
78
78
  data.append(verbose)
79
79
  file_path = os.path.join(dir_path, "verbose_hub_server.dat")
80
- file = open(file_path, "w+", "utf-8")
80
+ file = open(file_path, mode="w+", encoding="utf-8")
81
81
  file.writelines("\r\n".join(data))
82
82
  file.close()
83
83
 
@@ -87,14 +87,14 @@ def main():
87
87
  data = []
88
88
  data.append(server_ip)
89
89
  file_path = os.path.join(dir_path, "ip_of_grid_hub.dat")
90
- file = open(file_path, "w+", "utf-8")
90
+ file = open(file_path, mode="w+", encoding="utf-8")
91
91
  file.writelines("\r\n".join(data))
92
92
  file.close()
93
93
 
94
94
  data = []
95
95
  data.append(verbose)
96
96
  file_path = os.path.join(dir_path, "verbose_node_server.dat")
97
- file = open(file_path, "w+", "utf-8")
97
+ file = open(file_path, mode="w+", encoding="utf-8")
98
98
  file.writelines("\r\n".join(data))
99
99
  file.close()
100
100
 
@@ -59,7 +59,7 @@ def main():
59
59
  uses_keys = False
60
60
  uses_select = False
61
61
 
62
- with open(webdriver_python_file, "r", encoding="utf-8") as f:
62
+ with open(webdriver_python_file, mode="r", encoding="utf-8") as f:
63
63
  all_code = f.read()
64
64
  if "def test_" not in all_code:
65
65
  raise Exception(
@@ -893,7 +893,7 @@ def main():
893
893
  # Create SeleniumBase test file
894
894
  base_file_name = webdriver_python_file.split(".py")[0]
895
895
  converted_file_name = base_file_name + "_SB.py"
896
- out_file = open(converted_file_name, "w+", encoding="utf-8")
896
+ out_file = open(converted_file_name, mode="w+", encoding="utf-8")
897
897
  out_file.writelines(seleniumbase_code)
898
898
  out_file.close()
899
899
  print(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: seleniumbase
3
- Version: 4.43.1
3
+ Version: 4.43.2
4
4
  Summary: A complete web automation framework for end-to-end testing.
5
5
  Home-page: https://github.com/seleniumbase/SeleniumBase
6
6
  Author: Michael Mintz
@@ -94,7 +94,7 @@ Requires-Dist: pyyaml>=6.0.3
94
94
  Requires-Dist: pygments>=2.19.2
95
95
  Requires-Dist: pyreadline3>=3.5.4; platform_system == "Windows"
96
96
  Requires-Dist: tabcompleter>=1.4.0
97
- Requires-Dist: pdbp>=1.7.1
97
+ Requires-Dist: pdbp>=1.8.0
98
98
  Requires-Dist: idna>=3.11
99
99
  Requires-Dist: chardet==5.2.0
100
100
  Requires-Dist: charset-normalizer<4,>=3.4.4