seleniumbase 4.24.11__py3-none-any.whl → 4.33.15__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- sbase/__init__.py +1 -0
- sbase/steps.py +7 -0
- seleniumbase/__init__.py +16 -7
- seleniumbase/__version__.py +1 -1
- seleniumbase/behave/behave_sb.py +97 -32
- seleniumbase/common/decorators.py +16 -7
- seleniumbase/config/proxy_list.py +3 -3
- seleniumbase/config/settings.py +4 -0
- seleniumbase/console_scripts/logo_helper.py +47 -8
- seleniumbase/console_scripts/run.py +345 -335
- seleniumbase/console_scripts/sb_behave_gui.py +5 -12
- seleniumbase/console_scripts/sb_caseplans.py +6 -13
- seleniumbase/console_scripts/sb_commander.py +5 -12
- seleniumbase/console_scripts/sb_install.py +62 -54
- seleniumbase/console_scripts/sb_mkchart.py +13 -20
- seleniumbase/console_scripts/sb_mkdir.py +11 -17
- seleniumbase/console_scripts/sb_mkfile.py +69 -43
- seleniumbase/console_scripts/sb_mkpres.py +13 -20
- seleniumbase/console_scripts/sb_mkrec.py +88 -21
- seleniumbase/console_scripts/sb_objectify.py +30 -30
- seleniumbase/console_scripts/sb_print.py +5 -12
- seleniumbase/console_scripts/sb_recorder.py +16 -11
- seleniumbase/core/browser_launcher.py +1658 -221
- seleniumbase/core/log_helper.py +42 -27
- seleniumbase/core/mysql.py +1 -4
- seleniumbase/core/proxy_helper.py +35 -30
- seleniumbase/core/recorder_helper.py +24 -5
- seleniumbase/core/sb_cdp.py +1951 -0
- seleniumbase/core/sb_driver.py +162 -8
- seleniumbase/core/settings_parser.py +6 -0
- seleniumbase/core/style_sheet.py +10 -0
- seleniumbase/extensions/recorder.zip +0 -0
- seleniumbase/fixtures/base_case.py +1225 -614
- seleniumbase/fixtures/constants.py +10 -1
- seleniumbase/fixtures/js_utils.py +171 -144
- seleniumbase/fixtures/page_actions.py +177 -13
- seleniumbase/fixtures/page_utils.py +25 -53
- seleniumbase/fixtures/shared_utils.py +97 -11
- seleniumbase/js_code/active_css_js.py +1 -1
- seleniumbase/js_code/recorder_js.py +1 -1
- seleniumbase/plugins/base_plugin.py +2 -3
- seleniumbase/plugins/driver_manager.py +340 -65
- seleniumbase/plugins/pytest_plugin.py +276 -47
- seleniumbase/plugins/sb_manager.py +412 -99
- seleniumbase/plugins/selenium_plugin.py +122 -17
- seleniumbase/translate/translator.py +0 -7
- seleniumbase/undetected/__init__.py +59 -52
- seleniumbase/undetected/cdp.py +0 -1
- seleniumbase/undetected/cdp_driver/__init__.py +1 -0
- seleniumbase/undetected/cdp_driver/_contradict.py +110 -0
- seleniumbase/undetected/cdp_driver/browser.py +829 -0
- seleniumbase/undetected/cdp_driver/cdp_util.py +458 -0
- seleniumbase/undetected/cdp_driver/config.py +334 -0
- seleniumbase/undetected/cdp_driver/connection.py +639 -0
- seleniumbase/undetected/cdp_driver/element.py +1168 -0
- seleniumbase/undetected/cdp_driver/tab.py +1323 -0
- seleniumbase/undetected/dprocess.py +4 -7
- seleniumbase/undetected/options.py +6 -8
- seleniumbase/undetected/patcher.py +11 -13
- seleniumbase/undetected/reactor.py +0 -1
- seleniumbase/undetected/webelement.py +16 -3
- {seleniumbase-4.24.11.dist-info → seleniumbase-4.33.15.dist-info}/LICENSE +1 -1
- {seleniumbase-4.24.11.dist-info → seleniumbase-4.33.15.dist-info}/METADATA +299 -252
- {seleniumbase-4.24.11.dist-info → seleniumbase-4.33.15.dist-info}/RECORD +67 -69
- {seleniumbase-4.24.11.dist-info → seleniumbase-4.33.15.dist-info}/WHEEL +1 -1
- sbase/ReadMe.txt +0 -2
- seleniumbase/ReadMe.md +0 -25
- seleniumbase/common/ReadMe.md +0 -71
- seleniumbase/console_scripts/ReadMe.md +0 -731
- seleniumbase/drivers/ReadMe.md +0 -27
- seleniumbase/extensions/ReadMe.md +0 -12
- seleniumbase/masterqa/ReadMe.md +0 -61
- seleniumbase/resources/ReadMe.md +0 -31
- seleniumbase/resources/favicon.ico +0 -0
- seleniumbase/utilities/selenium_grid/ReadMe.md +0 -84
- seleniumbase/utilities/selenium_ide/ReadMe.md +0 -111
- {seleniumbase-4.24.11.dist-info → seleniumbase-4.33.15.dist-info}/entry_points.txt +0 -0
- {seleniumbase-4.24.11.dist-info → seleniumbase-4.33.15.dist-info}/top_level.txt +0 -0
sbase/__init__.py
CHANGED
sbase/steps.py
CHANGED
@@ -1189,3 +1189,10 @@ def set_attributes(context, selector, attribute, value):
|
|
1189
1189
|
if attribute.endswith("'") or attribute.endswith('"'):
|
1190
1190
|
attribute = attribute[:-1]
|
1191
1191
|
sb.set_attributes(selector, attribute, value)
|
1192
|
+
|
1193
|
+
|
1194
|
+
@step("Activate CDP Mode")
|
1195
|
+
@step("User activates CDP Mode")
|
1196
|
+
def activate_cdp_mode(context):
|
1197
|
+
sb = context.sb
|
1198
|
+
sb.activate_cdp_mode()
|
seleniumbase/__init__.py
CHANGED
@@ -1,10 +1,8 @@
|
|
1
1
|
import collections
|
2
|
+
import os
|
2
3
|
import pdb
|
3
|
-
try:
|
4
|
-
import pdbp # (Pdb+) --- Python Debugger Plus
|
5
|
-
except Exception:
|
6
|
-
pass
|
7
4
|
import sys
|
5
|
+
from contextlib import suppress
|
8
6
|
from selenium import webdriver
|
9
7
|
from seleniumbase.__version__ import __version__
|
10
8
|
from seleniumbase.common import decorators # noqa
|
@@ -14,7 +12,7 @@ from seleniumbase.core.browser_launcher import get_driver # noqa
|
|
14
12
|
from seleniumbase.fixtures import js_utils # noqa
|
15
13
|
from seleniumbase.fixtures import page_actions # noqa
|
16
14
|
from seleniumbase.fixtures import page_utils # noqa
|
17
|
-
from seleniumbase.fixtures import shared_utils
|
15
|
+
from seleniumbase.fixtures import shared_utils
|
18
16
|
from seleniumbase.fixtures.base_case import BaseCase # noqa
|
19
17
|
from seleniumbase.masterqa.master_qa import MasterQA # noqa
|
20
18
|
from seleniumbase.plugins.sb_manager import SB # noqa
|
@@ -22,6 +20,16 @@ from seleniumbase.plugins.driver_manager import Driver # noqa
|
|
22
20
|
from seleniumbase.plugins.driver_manager import DriverContext # noqa
|
23
21
|
from seleniumbase import translate # noqa
|
24
22
|
|
23
|
+
with suppress(Exception):
|
24
|
+
import colorama
|
25
|
+
|
26
|
+
with suppress(Exception):
|
27
|
+
import pdbp # (Pdb+) --- Python Debugger Plus
|
28
|
+
|
29
|
+
with suppress(Exception):
|
30
|
+
shared_utils.fix_colorama_if_windows()
|
31
|
+
colorama.init(autoreset=True)
|
32
|
+
|
25
33
|
if sys.version_info[0] < 3 and "pdbp" in locals():
|
26
34
|
# With Python3, "import pdbp" is all you need
|
27
35
|
for key in pdbp.__dict__.keys():
|
@@ -34,11 +42,12 @@ if sys.version_info[0] < 3 and "pdbp" in locals():
|
|
34
42
|
pdb.DefaultConfig.truncate_long_lines = False
|
35
43
|
pdb.DefaultConfig.sticky_by_default = True
|
36
44
|
colored_traceback.add_hook()
|
37
|
-
|
38
|
-
|
45
|
+
os.environ["SE_AVOID_STATS"] = "true" # Disable Selenium Manager stats
|
46
|
+
webdriver.TouchActions = None # Lifeline for past selenium-wire versions
|
39
47
|
if sys.version_info >= (3, 10):
|
40
48
|
collections.Callable = collections.abc.Callable # Lifeline for nosetests
|
41
49
|
del collections # Undo "import collections" / Simplify "dir(seleniumbase)"
|
50
|
+
del os # Undo "import os" / Simplify "dir(seleniumbase)"
|
42
51
|
del sys # Undo "import sys" / Simplify "dir(seleniumbase)"
|
43
52
|
del webdriver # Undo "import webdriver" / Simplify "dir(seleniumbase)"
|
44
53
|
|
seleniumbase/__version__.py
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
# seleniumbase package
|
2
|
-
__version__ = "4.
|
2
|
+
__version__ = "4.33.15"
|
seleniumbase/behave/behave_sb.py
CHANGED
@@ -42,11 +42,14 @@ behave -D agent="User Agent String" -D demo
|
|
42
42
|
-D binary-location=PATH (Set path of the Chromium browser binary to use.)
|
43
43
|
-D driver-version=VER (Set the chromedriver or uc_driver version to use.)
|
44
44
|
-D sjw (Skip JS Waits for readyState to be "complete" or Angular to load.)
|
45
|
+
-D wfa (Wait for AngularJS to be done loading after specific web actions.)
|
45
46
|
-D pls=PLS (Set pageLoadStrategy on Chrome: "normal", "eager", or "none".)
|
46
|
-
-D headless (
|
47
|
-
-D
|
47
|
+
-D headless (The default headless mode. Linux uses this mode by default.)
|
48
|
+
-D headless1 (Use Chrome's old headless mode. Fast, but has limitations.)
|
49
|
+
-D headless2 (Use Chrome's new headless mode, which supports extensions.)
|
48
50
|
-D headed (Run tests in headed/GUI mode on Linux OS, where not default.)
|
49
51
|
-D xvfb (Run tests using the Xvfb virtual display server on Linux OS.)
|
52
|
+
-D xvfb-metrics=STRING (Set Xvfb display size on Linux: "Width,Height".)
|
50
53
|
-D locale=LOCALE_CODE (Set the Language Locale Code for the web browser.)
|
51
54
|
-D pdb (Activate Post Mortem Debug Mode if a test fails.)
|
52
55
|
-D interval=SECONDS (The autoplay interval for presentations & tour steps)
|
@@ -68,7 +71,8 @@ behave -D agent="User Agent String" -D demo
|
|
68
71
|
-D rec-behave (Same as Recorder Mode, but also generates behave-gherkin.)
|
69
72
|
-D rec-sleep (If the Recorder is enabled, also records self.sleep calls.)
|
70
73
|
-D rec-print (If the Recorder is enabled, prints output after tests end.)
|
71
|
-
-D disable-
|
74
|
+
-D disable-cookies (Disable Cookies on websites. Pages might break!)
|
75
|
+
-D disable-js (Disable JavaScript on websites. Pages might break!)
|
72
76
|
-D disable-csp (Disable the Content Security Policy of websites.)
|
73
77
|
-D disable-ws (Disable Web Security on Chromium-based browsers.)
|
74
78
|
-D enable-ws (Enable Web Security on Chromium-based browsers.)
|
@@ -89,6 +93,7 @@ behave -D agent="User Agent String" -D demo
|
|
89
93
|
-D rcs | -D reuse-class-session (Reuse session for tests in class/feature)
|
90
94
|
-D crumbs (Delete all cookies between tests reusing a session.)
|
91
95
|
-D disable-beforeunload (Disable the "beforeunload" event on Chrome.)
|
96
|
+
-D window-position=X,Y (Set the browser's starting window position.)
|
92
97
|
-D window-size=WIDTH,HEIGHT (Set the browser's starting window size.)
|
93
98
|
-D maximize (Start tests with the browser window maximized.)
|
94
99
|
-D screenshot (Save a screenshot at the end of each test.)
|
@@ -103,6 +108,7 @@ import colorama
|
|
103
108
|
import os
|
104
109
|
import re
|
105
110
|
import sys
|
111
|
+
from contextlib import suppress
|
106
112
|
from seleniumbase import config as sb_config
|
107
113
|
from seleniumbase.config import settings
|
108
114
|
from seleniumbase.core import download_helper
|
@@ -140,10 +146,12 @@ def get_configured_sb(context):
|
|
140
146
|
sb.browser = "chrome"
|
141
147
|
sb.is_behave = True
|
142
148
|
sb.headless = False
|
149
|
+
sb.headless1 = False
|
143
150
|
sb.headless2 = False
|
144
151
|
sb.headless_active = False
|
145
152
|
sb.headed = False
|
146
153
|
sb.xvfb = False
|
154
|
+
sb.xvfb_metrics = None
|
147
155
|
sb.start_page = None
|
148
156
|
sb.locale_code = None
|
149
157
|
sb.pdb_option = False
|
@@ -173,6 +181,7 @@ def get_configured_sb(context):
|
|
173
181
|
sb.database_env = "test"
|
174
182
|
sb.log_path = constants.Logs.LATEST + os.sep
|
175
183
|
sb.archive_logs = False
|
184
|
+
sb.disable_cookies = False
|
176
185
|
sb.disable_js = False
|
177
186
|
sb.disable_csp = False
|
178
187
|
sb.disable_ws = False
|
@@ -192,6 +201,7 @@ def get_configured_sb(context):
|
|
192
201
|
sb._disable_beforeunload = False
|
193
202
|
sb.visual_baseline = False
|
194
203
|
sb.use_wire = False
|
204
|
+
sb.window_position = None
|
195
205
|
sb.window_size = None
|
196
206
|
sb.maximize_option = False
|
197
207
|
sb.is_context_manager = False
|
@@ -290,6 +300,11 @@ def get_configured_sb(context):
|
|
290
300
|
sb.headless = True
|
291
301
|
continue
|
292
302
|
# Handle: -D headless2
|
303
|
+
if low_key == "headless1":
|
304
|
+
sb.headless1 = True
|
305
|
+
sb.headless = True
|
306
|
+
continue
|
307
|
+
# Handle: -D headless2
|
293
308
|
if low_key == "headless2":
|
294
309
|
sb.headless2 = True
|
295
310
|
continue
|
@@ -301,6 +316,13 @@ def get_configured_sb(context):
|
|
301
316
|
if low_key == "xvfb":
|
302
317
|
sb.xvfb = True
|
303
318
|
continue
|
319
|
+
# Handle: -D xvfb-metrics=STR / xvfb_metrics=STR
|
320
|
+
if low_key in ["xvfb-metrics", "xvfb_metrics"]:
|
321
|
+
xvfb_metrics = userdata[key]
|
322
|
+
if xvfb_metrics == "true":
|
323
|
+
xvfb_metrics = sb.xvfb_metrics # revert to default
|
324
|
+
sb.xvfb_metrics = xvfb_metrics
|
325
|
+
continue
|
304
326
|
# Handle: -D start-page=URL / start_page=URL / url=URL
|
305
327
|
if low_key in ["start-page", "start_page", "url"]:
|
306
328
|
start_page = userdata[key]
|
@@ -515,16 +537,20 @@ def get_configured_sb(context):
|
|
515
537
|
if low_key in ["archive-logs", "archive_logs"]:
|
516
538
|
sb.archive_logs = True
|
517
539
|
continue
|
540
|
+
# Handle: -D disable-cookies / disable_cookies
|
541
|
+
if low_key in ["disable-cookies", "disable_cookies"]:
|
542
|
+
sb.disable_cookies = True
|
543
|
+
continue
|
518
544
|
# Handle: -D disable-js / disable_js
|
519
545
|
if low_key in ["disable-js", "disable_js"]:
|
520
546
|
sb.disable_js = True
|
521
547
|
continue
|
522
|
-
# Handle: -D disable-csp / disable_csp
|
523
|
-
if low_key in ["disable-csp", "disable_csp"]:
|
548
|
+
# Handle: -D disable-csp / disable_csp / dcsp
|
549
|
+
if low_key in ["disable-csp", "disable_csp", "dcsp"]:
|
524
550
|
sb.disable_csp = True
|
525
551
|
continue
|
526
|
-
# Handle: -D disable-ws / disable_ws
|
527
|
-
if low_key in ["disable-ws", "disable_ws"]:
|
552
|
+
# Handle: -D disable-ws / disable_ws / dws
|
553
|
+
if low_key in ["disable-ws", "disable_ws", "dws"]:
|
528
554
|
sb.disable_ws = True
|
529
555
|
continue
|
530
556
|
# Handle: -D enable-ws / enable_ws
|
@@ -588,6 +614,10 @@ def get_configured_sb(context):
|
|
588
614
|
if low_key in ["sjw", "skip-js-waits", "skip_js_waits"]:
|
589
615
|
settings.SKIP_JS_WAITS = True
|
590
616
|
continue
|
617
|
+
# Handle: -D wfa / wait-for-angularjs / wait_for_angularjs
|
618
|
+
if low_key in ["wfa", "wait-for-angularjs", "wait_for_angularjs"]:
|
619
|
+
settings.WAIT_FOR_ANGULARJS = True
|
620
|
+
continue
|
591
621
|
# Handle: -D visual-baseline / visual_baseline
|
592
622
|
if low_key in ["visual-baseline", "visual_baseline"]:
|
593
623
|
sb.visual_baseline = True
|
@@ -596,6 +626,13 @@ def get_configured_sb(context):
|
|
596
626
|
if low_key == "wire":
|
597
627
|
sb.use_wire = True
|
598
628
|
continue
|
629
|
+
# Handle: -D window-position=X,Y / window_position=X,Y
|
630
|
+
if low_key in ["window-position", "window_position"]:
|
631
|
+
window_position = userdata[key]
|
632
|
+
if window_position == "true":
|
633
|
+
window_position = sb.window_position # revert to default
|
634
|
+
sb.window_position = window_position
|
635
|
+
continue
|
599
636
|
# Handle: -D window-size=Width,Height / window_size=Width,Height
|
600
637
|
if low_key in ["window-size", "window_size"]:
|
601
638
|
window_size = userdata[key]
|
@@ -840,6 +877,7 @@ def get_configured_sb(context):
|
|
840
877
|
# Recorder Mode can still optimize scripts in "-D headless2" mode.
|
841
878
|
if sb.recorder_ext and sb.headless:
|
842
879
|
sb.headless = False
|
880
|
+
sb.headless1 = False
|
843
881
|
sb.headless2 = True
|
844
882
|
if sb.headless2 and sb.browser == "firefox":
|
845
883
|
sb.headless2 = False # Only for Chromium browsers
|
@@ -862,22 +900,27 @@ def get_configured_sb(context):
|
|
862
900
|
and not sb.headless2
|
863
901
|
and not sb.xvfb
|
864
902
|
):
|
865
|
-
|
866
|
-
|
867
|
-
|
868
|
-
|
869
|
-
|
870
|
-
|
871
|
-
|
872
|
-
|
903
|
+
if not sb.undetectable:
|
904
|
+
print(
|
905
|
+
'(Linux uses "-D headless" by default. '
|
906
|
+
'To override, use "-D headed" / "-D gui". '
|
907
|
+
'For Xvfb mode instead, use "-D xvfb". '
|
908
|
+
"Or you can hide this info by using"
|
909
|
+
'"-D headless" / "-D headless2" / "-D uc".)'
|
910
|
+
)
|
911
|
+
sb.headless = True
|
912
|
+
else:
|
913
|
+
sb.xvfb = True
|
873
914
|
# Recorder Mode can still optimize scripts in --headless2 mode.
|
874
915
|
if sb.recorder_mode and sb.headless:
|
875
916
|
sb.headless = False
|
917
|
+
sb.headless1 = False
|
876
918
|
sb.headless2 = True
|
877
919
|
if not sb.headless and not sb.headless2:
|
878
920
|
sb.headed = True
|
879
921
|
if sb.browser == "safari" and sb.headless:
|
880
922
|
sb.headless = False # Safari doesn't support headless mode
|
923
|
+
sb.headless1 = False
|
881
924
|
if sb.save_screenshot_after_test and sb.no_screenshot_after_test:
|
882
925
|
sb.save_screenshot_after_test = False # "no_screenshot" has priority
|
883
926
|
if sb.servername != "localhost":
|
@@ -886,6 +929,39 @@ def get_configured_sb(context):
|
|
886
929
|
# If the port is "443", the protocol is "https"
|
887
930
|
if str(sb.port) == "443":
|
888
931
|
sb.protocol = "https"
|
932
|
+
if (
|
933
|
+
(sb.enable_ws is None and sb.disable_ws is None)
|
934
|
+
or (sb.disable_ws is not None and not sb.disable_ws)
|
935
|
+
or (sb.enable_ws is not None and sb.enable_ws)
|
936
|
+
):
|
937
|
+
sb.enable_ws = True
|
938
|
+
sb.disable_ws = False
|
939
|
+
else:
|
940
|
+
sb.enable_ws = False
|
941
|
+
sb.disable_ws = True
|
942
|
+
if sb.window_position:
|
943
|
+
window_position = sb.window_position
|
944
|
+
if window_position.count(",") != 1:
|
945
|
+
message = (
|
946
|
+
'\n\n window_position expects an "x,y" string!'
|
947
|
+
'\n (Your input was: "%s")\n' % window_position
|
948
|
+
)
|
949
|
+
raise Exception(message)
|
950
|
+
window_position = window_position.replace(" ", "")
|
951
|
+
win_x = None
|
952
|
+
win_y = None
|
953
|
+
try:
|
954
|
+
win_x = int(window_position.split(",")[0])
|
955
|
+
win_y = int(window_position.split(",")[1])
|
956
|
+
except Exception:
|
957
|
+
message = (
|
958
|
+
'\n\n Expecting integer values for "x,y"!'
|
959
|
+
'\n (window_position input was: "%s")\n'
|
960
|
+
% window_position
|
961
|
+
)
|
962
|
+
raise Exception(message)
|
963
|
+
settings.WINDOW_START_X = win_x
|
964
|
+
settings.WINDOW_START_Y = win_y
|
889
965
|
if sb.window_size:
|
890
966
|
window_size = sb.window_size
|
891
967
|
if window_size.count(",") != 1:
|
@@ -920,9 +996,11 @@ def get_configured_sb(context):
|
|
920
996
|
sb_config.is_pytest = False
|
921
997
|
sb_config.is_nosetest = False
|
922
998
|
sb_config.is_context_manager = False
|
999
|
+
sb_config.window_position = sb.window_position
|
923
1000
|
sb_config.window_size = sb.window_size
|
924
1001
|
sb_config.maximize_option = sb.maximize_option
|
925
1002
|
sb_config.xvfb = sb.xvfb
|
1003
|
+
sb_config.xvfb_metrics = sb.xvfb_metrics
|
926
1004
|
sb_config.reuse_class_session = sb._reuse_class_session
|
927
1005
|
sb_config.save_screenshot = sb.save_screenshot_after_test
|
928
1006
|
sb_config.no_screenshot = sb.no_screenshot_after_test
|
@@ -933,6 +1011,7 @@ def get_configured_sb(context):
|
|
933
1011
|
sb_config.pdb_option = sb.pdb_option
|
934
1012
|
sb_config.rec_behave = sb.rec_behave
|
935
1013
|
sb_config.rec_print = sb.rec_print
|
1014
|
+
sb_config.disable_cookies = sb.disable_cookies
|
936
1015
|
sb_config.disable_js = sb.disable_js
|
937
1016
|
sb_config.disable_csp = sb.disable_csp
|
938
1017
|
sb_config.record_sleep = sb.record_sleep
|
@@ -1144,20 +1223,14 @@ def behave_dashboard_prepare():
|
|
1144
1223
|
sb_config.item_count_untested = sb_config.item_count
|
1145
1224
|
dash_path = os.path.join(os.getcwd(), "dashboard.html")
|
1146
1225
|
star_len = len("Dashboard: ") + len(dash_path)
|
1147
|
-
|
1226
|
+
with suppress(Exception):
|
1148
1227
|
terminal_size = os.get_terminal_size().columns
|
1149
1228
|
if terminal_size > 30 and star_len > terminal_size:
|
1150
1229
|
star_len = terminal_size
|
1151
|
-
except Exception:
|
1152
|
-
pass
|
1153
1230
|
stars = "*" * star_len
|
1154
1231
|
c1 = ""
|
1155
1232
|
cr = ""
|
1156
1233
|
if not is_linux:
|
1157
|
-
if is_windows and hasattr(colorama, "just_fix_windows_console"):
|
1158
|
-
colorama.just_fix_windows_console()
|
1159
|
-
else:
|
1160
|
-
colorama.init(autoreset=True)
|
1161
1234
|
c1 = colorama.Fore.BLUE + colorama.Back.LIGHTCYAN_EX
|
1162
1235
|
cr = colorama.Style.RESET_ALL
|
1163
1236
|
print("Dashboard: %s%s%s\n%s" % (c1, dash_path, cr, stars))
|
@@ -1245,7 +1318,7 @@ def _perform_behave_unconfigure_():
|
|
1245
1318
|
|
1246
1319
|
|
1247
1320
|
def do_final_driver_cleanup_as_needed():
|
1248
|
-
|
1321
|
+
with suppress(Exception):
|
1249
1322
|
if hasattr(sb_config, "last_driver") and sb_config.last_driver:
|
1250
1323
|
if (
|
1251
1324
|
not is_windows
|
@@ -1253,8 +1326,6 @@ def do_final_driver_cleanup_as_needed():
|
|
1253
1326
|
or sb_config.last_driver.service.process
|
1254
1327
|
):
|
1255
1328
|
sb_config.last_driver.quit()
|
1256
|
-
except Exception:
|
1257
|
-
pass
|
1258
1329
|
|
1259
1330
|
|
1260
1331
|
def _perform_behave_terminal_summary_():
|
@@ -1263,20 +1334,14 @@ def _perform_behave_terminal_summary_():
|
|
1263
1334
|
)
|
1264
1335
|
dash_path = os.path.join(os.getcwd(), "dashboard.html")
|
1265
1336
|
equals_len = len("Dashboard: ") + len(dash_path)
|
1266
|
-
|
1337
|
+
with suppress(Exception):
|
1267
1338
|
terminal_size = os.get_terminal_size().columns
|
1268
1339
|
if terminal_size > 30 and equals_len > terminal_size:
|
1269
1340
|
equals_len = terminal_size
|
1270
|
-
except Exception:
|
1271
|
-
pass
|
1272
1341
|
equals = "=" * (equals_len + 2)
|
1273
1342
|
c2 = ""
|
1274
1343
|
cr = ""
|
1275
1344
|
if not is_linux:
|
1276
|
-
if is_windows and hasattr(colorama, "just_fix_windows_console"):
|
1277
|
-
colorama.just_fix_windows_console()
|
1278
|
-
else:
|
1279
|
-
colorama.init(autoreset=True)
|
1280
1345
|
c2 = colorama.Fore.MAGENTA + colorama.Back.LIGHTYELLOW_EX
|
1281
1346
|
cr = colorama.Style.RESET_ALL
|
1282
1347
|
if sb_config.dashboard:
|
@@ -1,11 +1,18 @@
|
|
1
|
+
import colorama
|
1
2
|
import logging
|
2
3
|
import math
|
4
|
+
import sys
|
3
5
|
import time
|
4
6
|
import warnings
|
5
7
|
from contextlib import contextmanager
|
6
8
|
from functools import wraps
|
7
9
|
from seleniumbase.common.exceptions import TimeoutException
|
8
10
|
|
11
|
+
c1 = colorama.Fore.BLUE + colorama.Back.LIGHTYELLOW_EX
|
12
|
+
cr = colorama.Style.RESET_ALL
|
13
|
+
if "linux" in sys.platform:
|
14
|
+
c1 = cr = ""
|
15
|
+
|
9
16
|
|
10
17
|
@contextmanager
|
11
18
|
def print_runtime(description=None, limit=None):
|
@@ -43,23 +50,25 @@ def print_runtime(description=None, limit=None):
|
|
43
50
|
finally:
|
44
51
|
end_time = time.time()
|
45
52
|
run_time = end_time - start_time
|
53
|
+
name = description
|
54
|
+
info = c1 + "<info>" + cr
|
46
55
|
# Print times with a statistically significant number of decimal places
|
47
56
|
if run_time < 0.0001:
|
48
|
-
print("
|
57
|
+
print("%s - {%s} ran for %.7f seconds." % (info, name, run_time))
|
49
58
|
elif run_time < 0.001:
|
50
|
-
print("
|
59
|
+
print("%s - {%s} ran for %.6f seconds." % (info, name, run_time))
|
51
60
|
elif run_time < 0.01:
|
52
|
-
print("
|
61
|
+
print("%s - {%s} ran for %.5f seconds." % (info, name, run_time))
|
53
62
|
elif run_time < 0.1:
|
54
|
-
print("
|
63
|
+
print("%s - {%s} ran for %.4f seconds." % (info, name, run_time))
|
55
64
|
elif run_time < 1:
|
56
|
-
print("
|
65
|
+
print("%s - {%s} ran for %.3f seconds." % (info, name, run_time))
|
57
66
|
else:
|
58
|
-
print("
|
67
|
+
print("%s - {%s} ran for %.2f seconds." % (info, name, run_time))
|
59
68
|
if limit and limit > 0 and run_time > limit:
|
60
69
|
message = (
|
61
70
|
"\n {%s} duration of %.2fs exceeded the time limit of %.2fs!"
|
62
|
-
% (
|
71
|
+
% (name, run_time, limit)
|
63
72
|
)
|
64
73
|
if exception:
|
65
74
|
message = exception.msg + "\nAND " + message
|
@@ -23,9 +23,9 @@ you can try finding one from one of following sites:
|
|
23
23
|
"""
|
24
24
|
|
25
25
|
PROXY_LIST = {
|
26
|
-
"example1": "
|
27
|
-
"example2": "
|
28
|
-
"example3": "socks5://
|
26
|
+
"example1": "35.185.196.38:3128", # (Example) - set your own proxy here
|
27
|
+
"example2": "129.80.134.71:3128", # (Example)
|
28
|
+
"example3": "socks5://184.178.172.5:15303", # (Example)
|
29
29
|
"proxy1": None,
|
30
30
|
"proxy2": None,
|
31
31
|
"proxy3": None,
|
seleniumbase/config/settings.py
CHANGED
@@ -110,6 +110,10 @@ DISABLE_CSP_ON_CHROME = False
|
|
110
110
|
# (This applies when using --proxy=[PROXY_STRING] for using a proxy server.)
|
111
111
|
RAISE_INVALID_PROXY_STRING_EXCEPTION = True
|
112
112
|
|
113
|
+
# Default browser coordinates when opening new windows for tests.
|
114
|
+
WINDOW_START_X = 20
|
115
|
+
WINDOW_START_Y = 54
|
116
|
+
|
113
117
|
# Default browser resolutions when opening new windows for tests.
|
114
118
|
# (Headless resolutions take priority, and include all browsers.)
|
115
119
|
# (Firefox starts maximized by default when running in GUI Mode.)
|
@@ -3,7 +3,8 @@
|
|
3
3
|
http://www.patorjk.com/software/taag/#p=display&f=Slant&t=SeleniumBase """
|
4
4
|
|
5
5
|
import colorama
|
6
|
-
import
|
6
|
+
import os
|
7
|
+
from contextlib import suppress
|
7
8
|
|
8
9
|
r"""
|
9
10
|
______ __ _ ____
|
@@ -15,13 +16,6 @@ r"""
|
|
15
16
|
|
16
17
|
|
17
18
|
def get_seleniumbase_logo():
|
18
|
-
if (
|
19
|
-
"win32" in sys.platform
|
20
|
-
and hasattr(colorama, "just_fix_windows_console")
|
21
|
-
):
|
22
|
-
colorama.just_fix_windows_console()
|
23
|
-
else:
|
24
|
-
colorama.init(autoreset=True)
|
25
19
|
c1 = colorama.Fore.BLUE + colorama.Back.LIGHTCYAN_EX
|
26
20
|
c2 = colorama.Fore.BLUE + colorama.Back.LIGHTGREEN_EX
|
27
21
|
c3 = colorama.Back.CYAN
|
@@ -66,4 +60,49 @@ def get_seleniumbase_logo():
|
|
66
60
|
sb += " "
|
67
61
|
sb += cr
|
68
62
|
sb += cr
|
63
|
+
with suppress(Exception):
|
64
|
+
terminal_width = os.get_terminal_size().columns
|
65
|
+
if isinstance(terminal_width, int) and terminal_width >= 66:
|
66
|
+
return sb
|
67
|
+
|
68
|
+
# If the logo is wider than the screen width, use a smaller one:
|
69
|
+
r"""
|
70
|
+
___ _ _ ___
|
71
|
+
/ __| ___| |___ _ _ (_)_ _ _ __ | _ ) __ _ ______
|
72
|
+
\__ \/ -_) / -_) ' \| | \| | ' \ | _ \/ _` (_-< -_)
|
73
|
+
|___/\___|_\___|_||_|_|\_,_|_|_|_\|___/\__,_/__|___|
|
74
|
+
"""
|
75
|
+
sb = " "
|
76
|
+
sb += cr
|
77
|
+
sb += "\n"
|
78
|
+
sb += c1
|
79
|
+
sb += " ___ _ _ "
|
80
|
+
sb += c2
|
81
|
+
sb += " ___ "
|
82
|
+
sb += cr
|
83
|
+
sb += "\n"
|
84
|
+
sb += c1
|
85
|
+
sb += "/ __| ___| |___ _ _ (_)_ _ _ __ "
|
86
|
+
sb += c2
|
87
|
+
sb += "| _ ) __ _ ______ "
|
88
|
+
sb += cr
|
89
|
+
sb += "\n"
|
90
|
+
sb += c1
|
91
|
+
sb += "\\__ \\/ -_) / -_) ' \\| | \\| | ' \\ "
|
92
|
+
sb += c2
|
93
|
+
sb += "| _ \\/ _` (_-< -_)"
|
94
|
+
sb += cr
|
95
|
+
sb += "\n"
|
96
|
+
sb += c1
|
97
|
+
sb += "|___/\\___|_\\___|_||_|_|\\_,_|_|_|_\\"
|
98
|
+
sb += c2
|
99
|
+
sb += "|___/\\__,_/__|___|"
|
100
|
+
sb += cr
|
101
|
+
sb += "\n"
|
102
|
+
sb += c3
|
103
|
+
sb += " "
|
104
|
+
sb += c4
|
105
|
+
sb += " "
|
106
|
+
sb += cr
|
107
|
+
sb += cr
|
69
108
|
return sb
|