seleniumbase 4.41.3__py3-none-any.whl → 4.45.10__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.
Files changed (64) hide show
  1. sbase/steps.py +9 -0
  2. seleniumbase/__version__.py +1 -1
  3. seleniumbase/behave/behave_helper.py +2 -0
  4. seleniumbase/behave/behave_sb.py +21 -8
  5. seleniumbase/common/decorators.py +3 -1
  6. seleniumbase/console_scripts/run.py +1 -0
  7. seleniumbase/console_scripts/sb_caseplans.py +3 -4
  8. seleniumbase/console_scripts/sb_install.py +142 -11
  9. seleniumbase/console_scripts/sb_mkchart.py +1 -2
  10. seleniumbase/console_scripts/sb_mkdir.py +99 -29
  11. seleniumbase/console_scripts/sb_mkfile.py +1 -2
  12. seleniumbase/console_scripts/sb_mkpres.py +1 -2
  13. seleniumbase/console_scripts/sb_mkrec.py +26 -2
  14. seleniumbase/console_scripts/sb_objectify.py +4 -5
  15. seleniumbase/console_scripts/sb_print.py +1 -1
  16. seleniumbase/console_scripts/sb_recorder.py +40 -3
  17. seleniumbase/core/browser_launcher.py +474 -151
  18. seleniumbase/core/detect_b_ver.py +258 -16
  19. seleniumbase/core/log_helper.py +15 -21
  20. seleniumbase/core/mysql.py +1 -1
  21. seleniumbase/core/recorder_helper.py +3 -0
  22. seleniumbase/core/report_helper.py +9 -12
  23. seleniumbase/core/sb_cdp.py +734 -215
  24. seleniumbase/core/sb_driver.py +46 -5
  25. seleniumbase/core/session_helper.py +2 -4
  26. seleniumbase/core/tour_helper.py +1 -2
  27. seleniumbase/drivers/atlas_drivers/__init__.py +0 -0
  28. seleniumbase/drivers/brave_drivers/__init__.py +0 -0
  29. seleniumbase/drivers/chromium_drivers/__init__.py +0 -0
  30. seleniumbase/drivers/comet_drivers/__init__.py +0 -0
  31. seleniumbase/drivers/opera_drivers/__init__.py +0 -0
  32. seleniumbase/fixtures/base_case.py +448 -251
  33. seleniumbase/fixtures/constants.py +36 -9
  34. seleniumbase/fixtures/js_utils.py +77 -18
  35. seleniumbase/fixtures/page_actions.py +41 -13
  36. seleniumbase/fixtures/page_utils.py +19 -12
  37. seleniumbase/fixtures/shared_utils.py +64 -6
  38. seleniumbase/masterqa/master_qa.py +16 -2
  39. seleniumbase/plugins/base_plugin.py +8 -0
  40. seleniumbase/plugins/basic_test_info.py +2 -3
  41. seleniumbase/plugins/driver_manager.py +131 -5
  42. seleniumbase/plugins/page_source.py +2 -3
  43. seleniumbase/plugins/pytest_plugin.py +244 -79
  44. seleniumbase/plugins/sb_manager.py +143 -20
  45. seleniumbase/plugins/selenium_plugin.py +144 -12
  46. seleniumbase/translate/translator.py +2 -3
  47. seleniumbase/undetected/__init__.py +17 -13
  48. seleniumbase/undetected/cdp.py +1 -12
  49. seleniumbase/undetected/cdp_driver/browser.py +330 -129
  50. seleniumbase/undetected/cdp_driver/cdp_util.py +328 -61
  51. seleniumbase/undetected/cdp_driver/config.py +110 -14
  52. seleniumbase/undetected/cdp_driver/connection.py +18 -48
  53. seleniumbase/undetected/cdp_driver/element.py +105 -33
  54. seleniumbase/undetected/cdp_driver/tab.py +414 -39
  55. seleniumbase/utilities/selenium_grid/download_selenium_server.py +1 -1
  56. seleniumbase/utilities/selenium_grid/grid_hub.py +1 -2
  57. seleniumbase/utilities/selenium_grid/grid_node.py +2 -3
  58. seleniumbase/utilities/selenium_ide/convert_ide.py +2 -3
  59. {seleniumbase-4.41.3.dist-info → seleniumbase-4.45.10.dist-info}/METADATA +193 -166
  60. {seleniumbase-4.41.3.dist-info → seleniumbase-4.45.10.dist-info}/RECORD +64 -59
  61. {seleniumbase-4.41.3.dist-info → seleniumbase-4.45.10.dist-info}/licenses/LICENSE +1 -1
  62. {seleniumbase-4.41.3.dist-info → seleniumbase-4.45.10.dist-info}/WHEEL +0 -0
  63. {seleniumbase-4.41.3.dist-info → seleniumbase-4.45.10.dist-info}/entry_points.txt +0 -0
  64. {seleniumbase-4.41.3.dist-info → seleniumbase-4.45.10.dist-info}/top_level.txt +0 -0
@@ -10,6 +10,7 @@ Example:
10
10
 
11
11
  Options:
12
12
  -b / --basic (Only config files. No tests added.)
13
+ --gha (Include GitHub Actions YML with defaults.)
13
14
 
14
15
  Output:
15
16
  Creates a new folder for running SBase scripts.
@@ -18,7 +19,6 @@ Output:
18
19
  and Python boilerplates for setting up customized
19
20
  test frameworks.
20
21
  """
21
- import codecs
22
22
  import colorama
23
23
  import os
24
24
  import sys
@@ -33,6 +33,7 @@ def invalid_run_command(msg=None):
33
33
  exp += " sbase mkdir ui_tests\n"
34
34
  exp += " Options:\n"
35
35
  exp += " -b / --basic (Only config files. No tests added.)\n"
36
+ exp += " --gha (Include GitHub Actions YML with defaults.)\n"
36
37
  exp += " Output:\n"
37
38
  exp += " Creates a new folder for running SBase scripts.\n"
38
39
  exp += " The new folder contains default config files,\n"
@@ -59,6 +60,7 @@ def main():
59
60
  c7 = colorama.Fore.BLACK + colorama.Back.MAGENTA
60
61
  cr = colorama.Style.RESET_ALL
61
62
 
63
+ gha = False
62
64
  basic = False
63
65
  help_me = False
64
66
  error_msg = None
@@ -90,6 +92,8 @@ def main():
90
92
  help_me = True
91
93
  elif option == "-b" or option == "--basic":
92
94
  basic = True
95
+ elif option == "--gha":
96
+ gha = True
93
97
  else:
94
98
  invalid_cmd = "\n===> INVALID OPTION: >> %s <<\n" % option
95
99
  invalid_cmd = invalid_cmd.replace(">> ", ">>" + c5 + " ")
@@ -114,7 +118,7 @@ def main():
114
118
  data.append(seleniumbase_req)
115
119
  data.append("")
116
120
  file_path = "%s/%s" % (dir_name, "requirements.txt")
117
- file = codecs.open(file_path, "w+", "utf-8")
121
+ file = open(file_path, mode="w+", encoding="utf-8")
118
122
  file.writelines("\r\n".join(data))
119
123
  file.close()
120
124
 
@@ -152,7 +156,7 @@ def main():
152
156
  data.append(" production: custom marker")
153
157
  data.append("")
154
158
  file_path = "%s/%s" % (dir_name, "pytest.ini")
155
- file = codecs.open(file_path, "w+", "utf-8")
159
+ file = open(file_path, mode="w+", encoding="utf-8")
156
160
  file.writelines("\r\n".join(data))
157
161
  file.close()
158
162
 
@@ -169,14 +173,14 @@ def main():
169
173
  data.append("show_skipped=false")
170
174
  data.append("show_timings=false")
171
175
  file_path = "%s/%s" % (dir_name, "setup.cfg")
172
- file = codecs.open(file_path, "w+", "utf-8")
176
+ file = open(file_path, mode="w+", encoding="utf-8")
173
177
  file.writelines("\r\n".join(data))
174
178
  file.close()
175
179
 
176
180
  data = []
177
181
  data.append("")
178
182
  file_path = "%s/%s" % (dir_name, "__init__.py")
179
- file = codecs.open(file_path, "w+", "utf-8")
183
+ file = open(file_path, mode="w+", encoding="utf-8")
180
184
  file.writelines("\r\n".join(data))
181
185
  file.close()
182
186
 
@@ -247,6 +251,12 @@ def main():
247
251
  data.append("msedgedriver.exe")
248
252
  data.append("operadriver.exe")
249
253
  data.append("uc_driver.exe")
254
+ data.append("chrome-mac.zip")
255
+ data.append("chrome-linux.zip")
256
+ data.append("chrome-win.zip")
257
+ data.append("chrome-mac")
258
+ data.append("chrome-linux")
259
+ data.append("chrome-win")
250
260
  data.append("chrome-mac-arm64.zip")
251
261
  data.append("chrome-mac-x64.zip")
252
262
  data.append("chrome-linux64.zip")
@@ -312,19 +322,79 @@ def main():
312
322
  data.append("temp_*/")
313
323
  data.append("node_modules")
314
324
  file_path = "%s/%s" % (dir_name, ".gitignore")
315
- file = codecs.open(file_path, "w+", "utf-8")
325
+ file = open(file_path, mode="w+", encoding="utf-8")
316
326
  file.writelines("\r\n".join(data))
317
327
  file.close()
318
328
 
329
+ if gha:
330
+ dir_name_b = dir_name + "/" + ".github"
331
+ os.mkdir(dir_name_b)
332
+ dir_name_c = dir_name_b + "/" + "workflows"
333
+ os.mkdir(dir_name_c)
334
+
335
+ data = []
336
+ data.append("name: CI build")
337
+ data.append("on:")
338
+ data.append(" push:")
339
+ data.append(" branches:")
340
+ data.append(" pull_request:")
341
+ data.append(" branches:")
342
+ data.append(" workflow_dispatch:")
343
+ data.append(" branches:")
344
+ data.append("jobs:")
345
+ data.append(" build:")
346
+ data.append(" env:")
347
+ data.append(' PY_COLORS: "1"')
348
+ data.append(" strategy:")
349
+ data.append(" fail-fast: false")
350
+ data.append(" max-parallel: 15")
351
+ data.append(" matrix:")
352
+ data.append(" os: [ubuntu-latest]")
353
+ data.append(' python-version: ["3.x"]')
354
+ data.append(" runs-on: ${{ matrix.os }}")
355
+ data.append(" steps:")
356
+ data.append(" - uses: actions/checkout@v6")
357
+ data.append(" - name: Set up Python ${{ matrix.python-version }}")
358
+ data.append(" uses: actions/setup-python@v6")
359
+ data.append(" with:")
360
+ data.append(" python-version: ${{ matrix.python-version }}")
361
+ data.append(" - name: Install dependencies")
362
+ data.append(" run: |")
363
+ data.append(" python -m pip install --upgrade pip")
364
+ data.append(" pip install -r requirements.txt")
365
+ data.append(" - name: Install Chrome")
366
+ data.append(" if: matrix.os == 'ubuntu-latest'")
367
+ data.append(" run: sudo apt install google-chrome-stable")
368
+ data.append(" - name: Download chromedriver")
369
+ data.append(" run: sbase get chromedriver")
370
+ data.append(" - name: Run pytest")
371
+ data.append(" run: pytest -v -s --rs --crumbs --reruns=1")
372
+ data.append(" - name: Upload artifacts")
373
+ data.append(" if: ${{ always() }}")
374
+ data.append(" uses: actions/upload-artifact@v6")
375
+ data.append(" with:")
376
+ data.append(" name: seleniumbase-artifacts")
377
+ data.append(" path: ./latest_logs/")
378
+ data.append(" if-no-files-found: ignore")
379
+ data.append("")
380
+ file_path = "%s/%s" % (dir_name_c, "python-package.yml")
381
+ file = open(file_path, mode="w+", encoding="utf-8")
382
+ file.writelines("\r\n".join(data))
383
+ file.close()
384
+
319
385
  if basic:
320
386
  data = []
321
387
  data.append(" %s/" % dir_name)
388
+ if gha:
389
+ data.append(" ├── .github")
390
+ data.append(" │ └── workflows/")
391
+ data.append(" │ └── python-package.yml")
322
392
  data.append(" ├── __init__.py")
323
393
  data.append(" ├── pytest.ini")
324
394
  data.append(" ├── requirements.txt")
325
395
  data.append(" └── setup.cfg")
326
396
  file_path = "%s/%s" % (dir_name, "outline.rst")
327
- file = codecs.open(file_path, "w+", "utf-8")
397
+ file = open(file_path, mode="w+", encoding="utf-8")
328
398
  file.writelines("\r\n".join(data))
329
399
  file.close()
330
400
  os.system("sbase print %s -n" % file_path)
@@ -368,7 +438,7 @@ def main():
368
438
  data.append(' self.assert_element("div#login_button_container")')
369
439
  data.append("")
370
440
  file_path = "%s/%s" % (dir_name, "my_first_test.py")
371
- file = codecs.open(file_path, "w+", "utf-8")
441
+ file = open(file_path, mode="w+", encoding="utf-8")
372
442
  file.writelines("\r\n".join(data))
373
443
  file.close()
374
444
 
@@ -461,7 +531,7 @@ def main():
461
531
  data.append(' self.assert_text("SeleniumBase", "h2")')
462
532
  data.append("")
463
533
  file_path = "%s/%s" % (dir_name, "test_demo_site.py")
464
- file = codecs.open(file_path, "w+", "utf-8")
534
+ file = open(file_path, mode="w+", encoding="utf-8")
465
535
  file.writelines("\r\n".join(data))
466
536
  file.close()
467
537
 
@@ -498,9 +568,10 @@ def main():
498
568
  )
499
569
  data.append(' self.click(\'mark:contains("%s")\' % keyword)')
500
570
  data.append(' self.assert_title_contains(title_text)')
571
+ data.append(' self.save_screenshot_to_logs()')
501
572
  data.append("")
502
573
  file_path = "%s/%s" % (dir_name, "parameterized_test.py")
503
- file = codecs.open(file_path, "w+", "utf-8")
574
+ file = open(file_path, mode="w+", encoding="utf-8")
504
575
  file.writelines("\r\n".join(data))
505
576
  file.close()
506
577
 
@@ -510,7 +581,7 @@ def main():
510
581
  data = []
511
582
  data.append("")
512
583
  file_path = "%s/%s" % (dir_name_2, "__init__.py")
513
- file = codecs.open(file_path, "w+", "utf-8")
584
+ file = open(file_path, mode="w+", encoding="utf-8")
514
585
  file.writelines("\r\n".join(data))
515
586
  file.close()
516
587
 
@@ -545,7 +616,7 @@ def main():
545
616
  data.append(" pass")
546
617
  data.append("")
547
618
  file_path = "%s/%s" % (dir_name_2, "base_test_case.py")
548
- file = codecs.open(file_path, "w+", "utf-8")
619
+ file = open(file_path, mode="w+", encoding="utf-8")
549
620
  file.writelines("\r\n".join(data))
550
621
  file.close()
551
622
 
@@ -554,7 +625,7 @@ def main():
554
625
  data.append(' html = "html"')
555
626
  data.append("")
556
627
  file_path = "%s/%s" % (dir_name_2, "page_objects.py")
557
- file = codecs.open(file_path, "w+", "utf-8")
628
+ file = open(file_path, mode="w+", encoding="utf-8")
558
629
  file.writelines("\r\n".join(data))
559
630
  file.close()
560
631
 
@@ -570,7 +641,7 @@ def main():
570
641
  data.append(" self.assert_element(Page.html)")
571
642
  data.append("")
572
643
  file_path = "%s/%s" % (dir_name_2, "boilerplate_test.py")
573
- file = codecs.open(file_path, "w+", "utf-8")
644
+ file = open(file_path, mode="w+", encoding="utf-8")
574
645
  file.writelines("\r\n".join(data))
575
646
  file.close()
576
647
 
@@ -594,7 +665,7 @@ def main():
594
665
  data.append(' DataPage().add_input_text(self, "Goodbye!")')
595
666
  data.append("")
596
667
  file_path = "%s/%s" % (dir_name_2, "classic_obj_test.py")
597
- file = codecs.open(file_path, "w+", "utf-8")
668
+ file = open(file_path, mode="w+", encoding="utf-8")
598
669
  file.writelines("\r\n".join(data))
599
670
  file.close()
600
671
 
@@ -614,7 +685,7 @@ def main():
614
685
  data.append(' DataPage().add_input_text(sb, "Goodbye!")')
615
686
  data.append("")
616
687
  file_path = "%s/%s" % (dir_name_2, "sb_fixture_test.py")
617
- file = codecs.open(file_path, "w+", "utf-8")
688
+ file = open(file_path, mode="w+", encoding="utf-8")
618
689
  file.writelines("\r\n".join(data))
619
690
  file.close()
620
691
 
@@ -624,7 +695,7 @@ def main():
624
695
  data = []
625
696
  data.append("")
626
697
  file_path = "%s/%s" % (dir_name_3, "__init__.py")
627
- file = codecs.open(file_path, "w+", "utf-8")
698
+ file = open(file_path, mode="w+", encoding="utf-8")
628
699
  file.writelines("\r\n".join(data))
629
700
  file.close()
630
701
 
@@ -636,17 +707,12 @@ def main():
636
707
  data.append("")
637
708
  data.append("class GoogleTests(BaseCase):")
638
709
  data.append(" def test_google_dot_com(self):")
710
+ data.append(" if self.headless:")
711
+ data.append(' self.skip("Skipping test in headless mode.")')
639
712
  data.append(" if not self.undetectable:")
640
713
  data.append(" self.get_new_driver(undetectable=True)")
641
714
  data.append(' self.open("https://google.com/ncr")')
642
715
  data.append(' self.assert_title_contains("Google")')
643
- data.append(" self.sleep(0.05)")
644
- data.append(" self.save_screenshot_to_logs()")
645
- data.append(
646
- " self.wait_for_element('iframe[role=\"presentation\"]')"
647
- )
648
- data.append(" self.hide_elements('iframe')")
649
- data.append(" self.sleep(0.05)")
650
716
  data.append(" self.save_screenshot_to_logs()")
651
717
  data.append(' self.type(HomePage.search_box, "github.com")')
652
718
  data.append(" self.assert_element(HomePage.search_button)")
@@ -657,7 +723,7 @@ def main():
657
723
  )
658
724
  data.append("")
659
725
  file_path = "%s/%s" % (dir_name_3, "google_test.py")
660
- file = codecs.open(file_path, "w+", "utf-8")
726
+ file = open(file_path, mode="w+", encoding="utf-8")
661
727
  file.writelines("\r\n".join(data))
662
728
  file.close()
663
729
 
@@ -675,7 +741,7 @@ def main():
675
741
  data.append(' search_results = "div#center_col"')
676
742
  data.append("")
677
743
  file_path = "%s/%s" % (dir_name_3, "google_objects.py")
678
- file = codecs.open(file_path, "w+", "utf-8")
744
+ file = open(file_path, mode="w+", encoding="utf-8")
679
745
  file.writelines("\r\n".join(data))
680
746
  file.close()
681
747
 
@@ -707,7 +773,7 @@ def main():
707
773
  data.append(' self.assert_element("div#login_button_container")')
708
774
  data.append("")
709
775
  file_path = "%s/%s" % (dir_name_3, "swag_labs_test.py")
710
- file = codecs.open(file_path, "w+", "utf-8")
776
+ file = open(file_path, mode="w+", encoding="utf-8")
711
777
  file.writelines("\r\n".join(data))
712
778
  file.close()
713
779
 
@@ -734,12 +800,16 @@ def main():
734
800
  data.append(' sb.assert_element("div#login_button_container")')
735
801
  data.append("")
736
802
  file_path = "%s/%s" % (dir_name_3, "sb_swag_test.py")
737
- file = codecs.open(file_path, "w+", "utf-8")
803
+ file = open(file_path, mode="w+", encoding="utf-8")
738
804
  file.writelines("\r\n".join(data))
739
805
  file.close()
740
806
 
741
807
  data = []
742
808
  data.append(" %s/" % dir_name)
809
+ if gha:
810
+ data.append(" ├── .github")
811
+ data.append(" │ └── workflows/")
812
+ data.append(" │ └── python-package.yml")
743
813
  data.append(" ├── __init__.py")
744
814
  data.append(" ├── my_first_test.py")
745
815
  data.append(" ├── parameterized_test.py")
@@ -761,7 +831,7 @@ def main():
761
831
  data.append(" ├── sb_swag_test.py")
762
832
  data.append(" └── swag_labs_test.py")
763
833
  file_path = "%s/%s" % (dir_name, "outline.rst")
764
- file = codecs.open(file_path, "w+", "utf-8")
834
+ file = open(file_path, mode="w+", encoding="utf-8")
765
835
  file.writelines("\r\n".join(data))
766
836
  file.close()
767
837
  if " " not in file_path:
@@ -40,7 +40,6 @@ Output:
40
40
  BaseCase format supports Languages or Recorder Mode.
41
41
  UC Mode automatically uses English with SB() format.
42
42
  """
43
- import codecs
44
43
  import colorama
45
44
  import os
46
45
  import sys
@@ -413,7 +412,7 @@ def main():
413
412
  continue
414
413
  new_data.append(line)
415
414
  data = new_data
416
- file = codecs.open(file_path, "w+", "utf-8")
415
+ file = open(file_path, mode="w+", encoding="utf-8")
417
416
  file.writelines("\r\n".join(data))
418
417
  file.close()
419
418
  if " " not in file_name:
@@ -22,7 +22,6 @@ Output:
22
22
  and use "serif" theme with "slide" transition.
23
23
  The slides can be used as a basic boilerplate.
24
24
  """
25
- import codecs
26
25
  import colorama
27
26
  import os
28
27
  import sys
@@ -273,7 +272,7 @@ def main():
273
272
  continue
274
273
  new_data.append(line)
275
274
  data = new_data
276
- file = codecs.open(file_path, "w+", "utf-8")
275
+ file = open(file_path, mode="w+", encoding="utf-8")
277
276
  file.writelines("\r\n".join(data))
278
277
  file.close()
279
278
  if " " not in file_name:
@@ -29,7 +29,6 @@ Output:
29
29
  Creates a new SeleniumBase test using the Recorder.
30
30
  If the filename already exists, an error is raised.
31
31
  """
32
- import codecs
33
32
  import colorama
34
33
  import shutil
35
34
  import os
@@ -85,6 +84,11 @@ def main():
85
84
  error_msg = None
86
85
  invalid_cmd = None
87
86
  use_edge = False
87
+ use_opera = False
88
+ use_brave = False
89
+ use_comet = False
90
+ use_atlas = False
91
+ use_chromium = False
88
92
  use_uc = False
89
93
  esc_end = False
90
94
  start_page = None
@@ -139,6 +143,16 @@ def main():
139
143
  help_me = True
140
144
  elif option.lower() == "--edge":
141
145
  use_edge = True
146
+ elif option.lower() == "--opera":
147
+ use_opera = True
148
+ elif option.lower() == "--brave":
149
+ use_brave = True
150
+ elif option.lower() == "--comet":
151
+ use_comet = True
152
+ elif option.lower() == "--atlas":
153
+ use_atlas = True
154
+ elif option.lower() == "--use-chromium":
155
+ use_chromium = True
142
156
  elif option.lower() == "--ee":
143
157
  esc_end = True
144
158
  elif option.lower() in ("--gui", "--headed"):
@@ -240,7 +254,7 @@ def main():
240
254
  d2.append("")
241
255
  data = d2
242
256
 
243
- file = codecs.open(file_path, "w+", "utf-8")
257
+ file = open(file_path, mode="w+", encoding="utf-8")
244
258
  file.writelines("\r\n".join(data))
245
259
  file.close()
246
260
  success = (
@@ -276,6 +290,16 @@ def main():
276
290
  )
277
291
  if use_edge:
278
292
  run_cmd += " --edge"
293
+ elif use_opera:
294
+ run_cmd += " --opera"
295
+ elif use_brave:
296
+ run_cmd += " --brave"
297
+ elif use_comet:
298
+ run_cmd += " --comet"
299
+ elif use_atlas:
300
+ run_cmd += " --atlas"
301
+ elif use_chromium:
302
+ run_cmd += " --use-chromium"
279
303
  if force_gui:
280
304
  run_cmd += " --gui"
281
305
  if use_uc:
@@ -8,7 +8,6 @@ Output:
8
8
  have been replaced with variable names defined in
9
9
  "page_objects.py", supporting the Page Object Pattern.
10
10
  """
11
- import codecs
12
11
  import os
13
12
  import re
14
13
  import sys
@@ -136,7 +135,7 @@ def create_objects_file(selector_list_dict=None):
136
135
  data.append(' html = "html"')
137
136
  data.append("")
138
137
  file_path = PAGE_OBJECTS_FILE
139
- file = codecs.open(file_path, "w+", "utf-8")
138
+ file = open(file_path, mode="w+", encoding="utf-8")
140
139
  file.writelines("\r\n".join(data))
141
140
  file.close()
142
141
  if not selector_list_dict:
@@ -150,7 +149,7 @@ def scan_objects_file():
150
149
  create_objects_file()
151
150
 
152
151
  page_selectors = {}
153
- with open(PAGE_OBJECTS_FILE, "r", encoding="utf-8") as f:
152
+ with open(PAGE_OBJECTS_FILE, mode="r", encoding="utf-8") as f:
154
153
  all_code = f.read()
155
154
 
156
155
  var_names = []
@@ -3090,7 +3089,7 @@ def main(shell_command):
3090
3089
  "Expecting: %s\n" % (seleniumbase_file, expected_arg)
3091
3090
  )
3092
3091
 
3093
- with open(seleniumbase_file, "r", encoding="utf-8") as f:
3092
+ with open(seleniumbase_file, mode="r", encoding="utf-8") as f:
3094
3093
  all_code = f.read()
3095
3094
  if "def test_" not in all_code:
3096
3095
  raise Exception(
@@ -3189,7 +3188,7 @@ def main(shell_command):
3189
3188
  # Create SeleniumBase test file
3190
3189
  base_file_name = seleniumbase_file.split(".py")[0]
3191
3190
  converted_file_name = base_file_name + ".py" # Change end to make a copy
3192
- out_file = codecs.open(converted_file_name, "w+", encoding="utf-8")
3191
+ out_file = open(converted_file_name, mode="w+", encoding="utf-8")
3193
3192
  out_file.writelines(seleniumbase_code)
3194
3193
  out_file.close()
3195
3194
  print('\n>>> ["%s"] was updated!\n' % converted_file_name)
@@ -123,7 +123,7 @@ def main():
123
123
 
124
124
  all_code = None
125
125
  with open(
126
- file_to_print, "r+", encoding="utf-8", errors="ignore"
126
+ file_to_print, mode="r+", encoding="utf-8", errors="ignore"
127
127
  ) as f:
128
128
  all_code = f.read()
129
129
  all_code = all_code.replace("\t", " ")
@@ -144,6 +144,16 @@ def do_recording(file_name, url, overwrite_enabled, use_chrome, window):
144
144
  )
145
145
  if not use_chrome:
146
146
  command += " --edge"
147
+ elif "--opera" in command_args:
148
+ command += " --opera"
149
+ elif "--brave" in command_args:
150
+ command += " --brave"
151
+ elif "--comet" in command_args:
152
+ command += " --comet"
153
+ elif "--atlas" in command_args:
154
+ command += " --atlas"
155
+ elif "--use-chromium" in command_args:
156
+ command += " --use-chromium"
147
157
  if (
148
158
  "--uc" in command_args
149
159
  or "--cdp" in command_args
@@ -226,10 +236,37 @@ def create_tkinter_gui():
226
236
  chk = tk.Checkbutton(window, text="Overwrite existing files", variable=cbx)
227
237
  chk.pack()
228
238
  chk.select()
239
+ use_stealth = False
240
+ command_args = sys.argv[2:]
241
+ if (
242
+ "--uc" in command_args
243
+ or "--cdp" in command_args
244
+ or "--undetected" in command_args
245
+ or "--undetectable" in command_args
246
+ ):
247
+ use_stealth = True
248
+ browser_display = "Use Chrome over Edge"
249
+ if "--opera" in command_args:
250
+ browser_display = "Use Opera over Edge"
251
+ elif "--brave" in command_args:
252
+ browser_display = "Use Brave over Edge"
253
+ elif "--comet" in command_args:
254
+ browser_display = "Use Comet over Edge"
255
+ elif "--atlas" in command_args:
256
+ browser_display = "Use Atlas over Edge"
229
257
  cbb = tk.IntVar()
230
- chkb = tk.Checkbutton(window, text="Use Chrome over Edge", variable=cbb)
231
- chkb.pack()
232
- chkb.select()
258
+ if not use_stealth:
259
+ chkb = tk.Checkbutton(window, text=browser_display, variable=cbb)
260
+ chkb.pack()
261
+ if "--edge" not in command_args:
262
+ chkb.select()
263
+ else:
264
+ chkb = tk.Checkbutton(
265
+ window, text="Stealthy Chrome Mode", variable=cbb
266
+ )
267
+ chkb.pack()
268
+ chkb.select()
269
+ chkb.config(state=tk.DISABLED)
233
270
  tk.Label(window, text="").pack()
234
271
  url = tk.StringVar()
235
272
  tk.Label(window, text="Enter the URL to start recording on:").pack()