seleniumbase 4.29.4__py3-none-any.whl → 4.29.5__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.
@@ -1,2 +1,2 @@
1
1
  # seleniumbase package
2
- __version__ = "4.29.4"
2
+ __version__ = "4.29.5"
@@ -394,9 +394,9 @@ def uc_special_open_if_cf(
394
394
  )
395
395
  uc_metrics = {}
396
396
  if (
397
- isinstance(device_width, int)
398
- and isinstance(device_height, int)
399
- and isinstance(device_pixel_ratio, int)
397
+ isinstance(device_width, (int, float))
398
+ and isinstance(device_height, (int, float))
399
+ and isinstance(device_pixel_ratio, (int, float))
400
400
  ):
401
401
  uc_metrics["width"] = device_width
402
402
  uc_metrics["height"] = device_height
@@ -975,9 +975,24 @@ def uc_gui_click_cf(driver, frame="iframe", retry=False, blind=False):
975
975
  )
976
976
 
977
977
 
978
- def uc_gui_handle_cf(driver, frame="iframe"):
979
- if not _on_a_cf_turnstile_page(driver):
980
- return
978
+ def _uc_gui_handle_captcha(
979
+ driver,
980
+ frame="iframe",
981
+ ctype=None,
982
+ ):
983
+ if ctype == "cf_t":
984
+ if not _on_a_cf_turnstile_page(driver):
985
+ return
986
+ elif ctype == "g_rc":
987
+ if not _on_a_g_recaptcha_page(driver):
988
+ return
989
+ else:
990
+ if _on_a_g_recaptcha_page(driver):
991
+ ctype = "g_rc"
992
+ elif _on_a_cf_turnstile_page(driver):
993
+ ctype = "cf_t"
994
+ else:
995
+ return
981
996
  install_pyautogui_if_missing(driver)
982
997
  import pyautogui
983
998
  pyautogui = get_configured_pyautogui(pyautogui)
@@ -988,7 +1003,10 @@ def uc_gui_handle_cf(driver, frame="iframe"):
988
1003
  with gui_lock: # Prevent issues with multiple processes
989
1004
  needs_switch = False
990
1005
  is_in_frame = js_utils.is_in_frame(driver)
991
- if is_in_frame and driver.is_element_present("#challenge-stage"):
1006
+ selector = "#challenge-stage"
1007
+ if ctype == "g_rc":
1008
+ selector = "#recaptcha-token"
1009
+ if is_in_frame and driver.is_element_present(selector):
992
1010
  driver.switch_to.parent_frame()
993
1011
  needs_switch = True
994
1012
  is_in_frame = js_utils.is_in_frame(driver)
@@ -997,67 +1015,77 @@ def uc_gui_handle_cf(driver, frame="iframe"):
997
1015
  page_actions.switch_to_window(
998
1016
  driver, driver.current_window_handle, 2, uc_lock=False
999
1017
  )
1000
- if (
1001
- driver.is_element_present(".cf-turnstile-wrapper iframe")
1002
- or driver.is_element_present(
1003
- '[data-callback="onCaptchaSuccess"] iframe'
1004
- )
1005
- ):
1006
- pass
1007
- else:
1008
- visible_iframe = False
1009
- if driver.is_element_present(".cf-turnstile-wrapper"):
1010
- frame = ".cf-turnstile-wrapper"
1011
- elif driver.is_element_present(
1012
- '[data-callback="onCaptchaSuccess"]'
1013
- ):
1014
- frame = '[data-callback="onCaptchaSuccess"]'
1015
- elif (
1016
- driver.is_element_present('[name*="cf-turnstile-"]')
1017
- and driver.is_element_present("div.spacer div[style]")
1018
- ):
1019
- frame = "div.spacer div[style]"
1020
- elif (
1021
- (
1022
- driver.is_element_present('[name*="cf-turnstile-"]')
1023
- or driver.is_element_present('[id*="cf-turnstile-"]')
1024
- )
1025
- and driver.is_element_present(
1026
- 'form div div[style*="margin"][style*="padding"]'
1018
+ if ctype == "cf_t":
1019
+ if (
1020
+ driver.is_element_present(".cf-turnstile-wrapper iframe")
1021
+ or driver.is_element_present(
1022
+ '[data-callback="onCaptchaSuccess"] iframe'
1027
1023
  )
1028
1024
  ):
1029
- frame = 'form div div[style*="margin"][style*="padding"]'
1030
- elif (
1031
- (
1025
+ pass
1026
+ else:
1027
+ visible_iframe = False
1028
+ if driver.is_element_present(".cf-turnstile-wrapper"):
1029
+ frame = ".cf-turnstile-wrapper"
1030
+ elif driver.is_element_present(
1031
+ '[data-callback="onCaptchaSuccess"]'
1032
+ ):
1033
+ frame = '[data-callback="onCaptchaSuccess"]'
1034
+ elif (
1032
1035
  driver.is_element_present('[name*="cf-turnstile-"]')
1033
- or driver.is_element_present('[id*="cf-turnstile-"]')
1034
- )
1035
- and driver.is_element_present(
1036
- 'div > div > [style*="margin"][style*="padding"]'
1037
- )
1036
+ and driver.is_element_present("div.spacer div[style]")
1037
+ ):
1038
+ frame = "div.spacer div[style]"
1039
+ elif (
1040
+ (
1041
+ driver.is_element_present('[name*="cf-turnstile-"]')
1042
+ or driver.is_element_present('[id*="cf-turnstile-"]')
1043
+ )
1044
+ and driver.is_element_present(
1045
+ 'form div div[style*="margin"][style*="padding"]'
1046
+ )
1047
+ ):
1048
+ frame = 'form div div[style*="margin"][style*="padding"]'
1049
+ elif (
1050
+ (
1051
+ driver.is_element_present('[name*="cf-turnstile-"]')
1052
+ or driver.is_element_present('[id*="cf-turnstile-"]')
1053
+ )
1054
+ and driver.is_element_present(
1055
+ 'div > div > [style*="margin"][style*="padding"]'
1056
+ )
1057
+ ):
1058
+ frame = 'div > div > [style*="margin"][style*="padding"]'
1059
+ else:
1060
+ return
1061
+ else:
1062
+ if (
1063
+ driver.is_element_present('iframe[title="reCAPTCHA"]')
1064
+ and frame == "iframe"
1038
1065
  ):
1039
- frame = 'div > div > [style*="margin"][style*="padding"]'
1040
- else:
1041
- return
1066
+ frame = 'iframe[title="reCAPTCHA"]'
1042
1067
  if not is_in_frame or needs_switch:
1043
1068
  # Currently not in frame (or nested frame outside CF one)
1044
1069
  try:
1045
- if visible_iframe:
1070
+ if visible_iframe or ctype == "g_rc":
1046
1071
  driver.switch_to_frame(frame)
1047
1072
  except Exception:
1048
- if visible_iframe:
1073
+ if visible_iframe or ctype == "g_rc":
1049
1074
  if driver.is_element_present("iframe"):
1050
1075
  driver.switch_to_frame("iframe")
1051
1076
  else:
1052
1077
  return
1053
1078
  try:
1079
+ selector = "div.cf-turnstile"
1080
+ if ctype == "g_rc":
1081
+ selector = "span#recaptcha-anchor"
1054
1082
  found_checkbox = False
1055
1083
  for i in range(24):
1056
1084
  pyautogui.press("\t")
1057
1085
  time.sleep(0.02)
1058
1086
  active_element_css = js_utils.get_active_element_css(driver)
1059
1087
  if (
1060
- active_element_css.startswith("div.cf-turnstile")
1088
+ active_element_css.startswith(selector)
1061
1089
  or active_element_css.endswith(" > div" * 2)
1062
1090
  ):
1063
1091
  found_checkbox = True
@@ -1081,6 +1109,18 @@ def uc_gui_handle_cf(driver, frame="iframe"):
1081
1109
  driver.reconnect(reconnect_time)
1082
1110
 
1083
1111
 
1112
+ def uc_gui_handle_captcha(driver, frame="iframe"):
1113
+ _uc_gui_handle_captcha(driver, frame=frame, ctype=None)
1114
+
1115
+
1116
+ def uc_gui_handle_cf(driver, frame="iframe"):
1117
+ _uc_gui_handle_captcha(driver, frame=frame, ctype="cf_t")
1118
+
1119
+
1120
+ def uc_gui_handle_rc(driver, frame="iframe"):
1121
+ _uc_gui_handle_captcha(driver, frame=frame, ctype="g_rc")
1122
+
1123
+
1084
1124
  def uc_switch_to_frame(driver, frame="iframe", reconnect_time=None):
1085
1125
  from selenium.webdriver.remote.webelement import WebElement
1086
1126
  if isinstance(frame, WebElement):
@@ -1479,9 +1519,9 @@ def _set_chrome_options(
1479
1519
  emulator_settings = {}
1480
1520
  device_metrics = {}
1481
1521
  if (
1482
- isinstance(device_width, int)
1483
- and isinstance(device_height, int)
1484
- and isinstance(device_pixel_ratio, int)
1522
+ isinstance(device_width, (int, float))
1523
+ and isinstance(device_height, (int, float))
1524
+ and isinstance(device_pixel_ratio, (int, float))
1485
1525
  ):
1486
1526
  device_metrics["width"] = device_width
1487
1527
  device_metrics["height"] = device_height
@@ -3229,9 +3269,9 @@ def get_local_driver(
3229
3269
  emulator_settings = {}
3230
3270
  device_metrics = {}
3231
3271
  if (
3232
- isinstance(device_width, int)
3233
- and isinstance(device_height, int)
3234
- and isinstance(device_pixel_ratio, int)
3272
+ isinstance(device_width, (int, float))
3273
+ and isinstance(device_height, (int, float))
3274
+ and isinstance(device_pixel_ratio, (int, float))
3235
3275
  ):
3236
3276
  device_metrics["width"] = device_width
3237
3277
  device_metrics["height"] = device_height
@@ -4421,13 +4461,18 @@ def get_local_driver(
4421
4461
  driver, *args, **kwargs
4422
4462
  )
4423
4463
  )
4464
+ driver.uc_gui_click_cf = (
4465
+ lambda *args, **kwargs: uc_gui_click_cf(
4466
+ driver, *args, **kwargs
4467
+ )
4468
+ )
4424
4469
  driver.uc_gui_click_rc = (
4425
4470
  lambda *args, **kwargs: uc_gui_click_rc(
4426
4471
  driver, *args, **kwargs
4427
4472
  )
4428
4473
  )
4429
- driver.uc_gui_click_cf = (
4430
- lambda *args, **kwargs: uc_gui_click_cf(
4474
+ driver.uc_gui_handle_captcha = (
4475
+ lambda *args, **kwargs: uc_gui_handle_captcha(
4431
4476
  driver, *args, **kwargs
4432
4477
  )
4433
4478
  )
@@ -4436,6 +4481,11 @@ def get_local_driver(
4436
4481
  driver, *args, **kwargs
4437
4482
  )
4438
4483
  )
4484
+ driver.uc_gui_handle_rc = (
4485
+ lambda *args, **kwargs: uc_gui_handle_rc(
4486
+ driver, *args, **kwargs
4487
+ )
4488
+ )
4439
4489
  driver.uc_switch_to_frame = (
4440
4490
  lambda *args, **kwargs: uc_switch_to_frame(
4441
4491
  driver, *args, **kwargs
@@ -4446,9 +4496,9 @@ def get_local_driver(
4446
4496
  if mobile_emulator:
4447
4497
  uc_metrics = {}
4448
4498
  if (
4449
- isinstance(device_width, int)
4450
- and isinstance(device_height, int)
4451
- and isinstance(device_pixel_ratio, int)
4499
+ isinstance(device_width, (int, float))
4500
+ and isinstance(device_height, (int, float))
4501
+ and isinstance(device_pixel_ratio, (int, float))
4452
4502
  ):
4453
4503
  uc_metrics["width"] = device_width
4454
4504
  uc_metrics["height"] = device_height
@@ -4246,12 +4246,16 @@ class BaseCase(unittest.TestCase):
4246
4246
  self.uc_gui_click_x_y = new_driver.uc_gui_click_x_y
4247
4247
  if hasattr(new_driver, "uc_gui_click_captcha"):
4248
4248
  self.uc_gui_click_captcha = new_driver.uc_gui_click_captcha
4249
- if hasattr(new_driver, "uc_gui_click_rc"):
4250
- self.uc_gui_click_rc = new_driver.uc_gui_click_rc
4251
4249
  if hasattr(new_driver, "uc_gui_click_cf"):
4252
4250
  self.uc_gui_click_cf = new_driver.uc_gui_click_cf
4251
+ if hasattr(new_driver, "uc_gui_click_rc"):
4252
+ self.uc_gui_click_rc = new_driver.uc_gui_click_rc
4253
+ if hasattr(new_driver, "uc_gui_handle_captcha"):
4254
+ self.uc_gui_handle_captcha = new_driver.uc_gui_handle_captcha
4253
4255
  if hasattr(new_driver, "uc_gui_handle_cf"):
4254
4256
  self.uc_gui_handle_cf = new_driver.uc_gui_handle_cf
4257
+ if hasattr(new_driver, "uc_gui_handle_rc"):
4258
+ self.uc_gui_handle_rc = new_driver.uc_gui_handle_rc
4255
4259
  if hasattr(new_driver, "uc_switch_to_frame"):
4256
4260
  self.uc_switch_to_frame = new_driver.uc_switch_to_frame
4257
4261
  return new_driver
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: seleniumbase
3
- Version: 4.29.4
3
+ Version: 4.29.5
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
@@ -5,7 +5,7 @@ sbase/steps.py,sha256=bKT_u5bJkKzYWEuAXi9NVVRYYxQRCM1_YJUrNFFRVPY,42865
5
5
  seleniumbase/ReadMe.md,sha256=4nEdto4d0Ch0Zneg0yAC-RBBdqRqPUP0SCo-ze_XDPM,3612
6
6
  seleniumbase/__init__.py,sha256=dgq30q6wGO2fJOVYemxC5hLxzv-of-MRn5P1YarBq5k,2263
7
7
  seleniumbase/__main__.py,sha256=dn1p6dgCchmcH1zzTzzQvFwwdQQqnTGH6ULV9m4hv24,654
8
- seleniumbase/__version__.py,sha256=9wKpIa05eFqiwqGotD27Kkn8ry6rjgywgbO9xJ12u5M,46
8
+ seleniumbase/__version__.py,sha256=0HczSW_Tdr-OCCeHjw9Q5zGNL9yfcXXCfeTSGL5Xlzo,46
9
9
  seleniumbase/behave/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
10
  seleniumbase/behave/behave_helper.py,sha256=elkl8P9eLulRAioLstE9baYNM9N_PHBmAOcajX-pH_Y,24198
11
11
  seleniumbase/behave/behave_sb.py,sha256=q4uYZixZBf7VYWnQnEk2weTcyMy1X1faR3vyYvUzDiA,56406
@@ -40,7 +40,7 @@ seleniumbase/console_scripts/sb_print.py,sha256=yo641b_OdSE0GUauOyxk-QrNeIjYzbRY
40
40
  seleniumbase/console_scripts/sb_recorder.py,sha256=UQQhnAR18dbcC7ToDvj6TM2PIG5qBrNaekaM6kSK_E8,10970
41
41
  seleniumbase/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
42
42
  seleniumbase/core/application_manager.py,sha256=e_0sjtI8cjY5BNyZj1QBR0j6_oCScxGmSXYEpcYwuZE,576
43
- seleniumbase/core/browser_launcher.py,sha256=jeGM5-CWht3x4HmGKBcXXesoU2nx5V9yp4gg9d2oL3M,192285
43
+ seleniumbase/core/browser_launcher.py,sha256=RIQnvbJbpH9Ds6931tA16XxT3xXK8RDvFeQQDaYaC_A,194161
44
44
  seleniumbase/core/capabilities_parser.py,sha256=meIS2uHapTCq2ldfNAToC7r0cKmZDRXuYNKExM1GHDY,6038
45
45
  seleniumbase/core/colored_traceback.py,sha256=DrRWfg7XEnKcgY59Xj7Jdk09H-XqHYBSUpB-DiZt6iY,2020
46
46
  seleniumbase/core/create_db_tables.sql,sha256=VWPtrdiW_HQ6yETHjqTu-VIrTwvd8I8o1NfBeaVSHpU,972
@@ -70,7 +70,7 @@ seleniumbase/extensions/disable_csp.zip,sha256=YMifIIgEBiLrEFrS1sfW4Exh4br1V4oK1
70
70
  seleniumbase/extensions/recorder.zip,sha256=OOyzF-Ize2cSRu1CqhzSAq5vusI9hqLLd2OIApUHesI,11918
71
71
  seleniumbase/extensions/sbase_ext.zip,sha256=3s1N8zrVaMz8RQEOIoBzC3KDjtmHwVZRvVsX25Odr_s,8175
72
72
  seleniumbase/fixtures/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
73
- seleniumbase/fixtures/base_case.py,sha256=pWWWCBg_L1d0nfuK6g0rtlf232CvolEdUomxhmylG6A,701612
73
+ seleniumbase/fixtures/base_case.py,sha256=mgtLtLFrO9L0916qgYWYj0Fr7i7srtauGJfiFi-Yq3g,701875
74
74
  seleniumbase/fixtures/constants.py,sha256=TapuGLdERtvZPGMblVXkNGybr8tj8FMtN3sbJ3ygyoc,13569
75
75
  seleniumbase/fixtures/css_to_xpath.py,sha256=9ouDB1xl4MJ2os6JOgTIAyHKOQfuxtxvXC3O5hSnEKA,1954
76
76
  seleniumbase/fixtures/errors.py,sha256=KyxuEVx_e3MPhVrJfNIa_3ltMpbCFxfy_jxK8RFNTns,555
@@ -137,9 +137,9 @@ seleniumbase/utilities/selenium_grid/start-grid-hub.sh,sha256=KADv0RUHONLL2_I443
137
137
  seleniumbase/utilities/selenium_ide/ReadMe.md,sha256=hznGeuMpkIimqMiZBW-4goIy2ltW4l8X9kb0YSPUQfE,4483
138
138
  seleniumbase/utilities/selenium_ide/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
139
139
  seleniumbase/utilities/selenium_ide/convert_ide.py,sha256=pZFnqEJQEKZPyNFjkLD29s2HPQgCrWW9XJWpCPhWOoM,31691
140
- seleniumbase-4.29.4.dist-info/LICENSE,sha256=odSYtWibXBnQ1gBg6CnDZ82n8kLF_if5-2nbqnEyD8k,1085
141
- seleniumbase-4.29.4.dist-info/METADATA,sha256=XuKfOEiIF6mZwk5uDxr6GtSgJDnpsKEqIIjzb14-YoM,85695
142
- seleniumbase-4.29.4.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
143
- seleniumbase-4.29.4.dist-info/entry_points.txt,sha256=CNrh2EKNaHYEhO6pP1RJyVLB99LkDDYX7TnUK8xfjqk,623
144
- seleniumbase-4.29.4.dist-info/top_level.txt,sha256=4N97aBOQ8ETCnDnokBsWb07lJfTaq3C1ZzYRxvLMxqU,19
145
- seleniumbase-4.29.4.dist-info/RECORD,,
140
+ seleniumbase-4.29.5.dist-info/LICENSE,sha256=odSYtWibXBnQ1gBg6CnDZ82n8kLF_if5-2nbqnEyD8k,1085
141
+ seleniumbase-4.29.5.dist-info/METADATA,sha256=9KDnfWkf548uf1KzVll5zqW7aAQF2ApHMAYV7kLG5qQ,85695
142
+ seleniumbase-4.29.5.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
143
+ seleniumbase-4.29.5.dist-info/entry_points.txt,sha256=CNrh2EKNaHYEhO6pP1RJyVLB99LkDDYX7TnUK8xfjqk,623
144
+ seleniumbase-4.29.5.dist-info/top_level.txt,sha256=4N97aBOQ8ETCnDnokBsWb07lJfTaq3C1ZzYRxvLMxqU,19
145
+ seleniumbase-4.29.5.dist-info/RECORD,,