diff --git a/requirements.txt b/requirements.txt index d61302714bc..37d58a08012 100755 --- a/requirements.txt +++ b/requirements.txt @@ -14,7 +14,7 @@ typing-extensions>=4.12.2 sbvirtualdisplay>=1.3.0 six>=1.16.0 parse>=1.20.2 -parse-type>=0.6.3 +parse-type>=0.6.4 colorama>=0.4.6 pyyaml>=6.0.2 pygments>=2.18.0 @@ -55,7 +55,7 @@ pyotp==2.9.0 python-xlib==0.33;platform_system=="Linux" markdown-it-py==3.0.0 mdurl==0.1.2 -rich==13.9.1 +rich==13.9.2 # --- Testing Requirements --- # # ("pip install -r requirements.txt" also installs this, but "pip install -e ." won't.) diff --git a/seleniumbase/__version__.py b/seleniumbase/__version__.py index f6c1da56ad8..29332d95247 100755 --- a/seleniumbase/__version__.py +++ b/seleniumbase/__version__.py @@ -1,2 +1,2 @@ # seleniumbase package -__version__ = "4.31.3" +__version__ = "4.31.4" diff --git a/seleniumbase/behave/behave_sb.py b/seleniumbase/behave/behave_sb.py index 06668a96bbb..81f1fb8f098 100644 --- a/seleniumbase/behave/behave_sb.py +++ b/seleniumbase/behave/behave_sb.py @@ -545,12 +545,12 @@ def get_configured_sb(context): if low_key in ["disable-js", "disable_js"]: sb.disable_js = True continue - # Handle: -D disable-csp / disable_csp - if low_key in ["disable-csp", "disable_csp"]: + # Handle: -D disable-csp / disable_csp / dcsp + if low_key in ["disable-csp", "disable_csp", "dcsp"]: sb.disable_csp = True continue - # Handle: -D disable-ws / disable_ws - if low_key in ["disable-ws", "disable_ws"]: + # Handle: -D disable-ws / disable_ws / dws + if low_key in ["disable-ws", "disable_ws", "dws"]: sb.disable_ws = True continue # Handle: -D enable-ws / enable_ws diff --git a/seleniumbase/fixtures/base_case.py b/seleniumbase/fixtures/base_case.py index f74038999d3..b761a46ea54 100644 --- a/seleniumbase/fixtures/base_case.py +++ b/seleniumbase/fixtures/base_case.py @@ -14500,15 +14500,13 @@ def setUp(self, masterqa_mode=False): self.__skip_reason = None self.testcase_manager.insert_testcase_data(data_payload) self.case_start_time = int(time.time() * 1000.0) - self.__activate_virtual_display_as_needed() elif hasattr(self, "is_behave") and self.is_behave: self.__initialize_variables() - self.__activate_virtual_display_as_needed() elif hasattr(self, "is_nosetest") and self.is_nosetest: pass # Setup performed in plugins for pynose else: - # Pure Python run. Eg. SB() Manager - self.__activate_virtual_display_as_needed() + # Pure Python run. (Eg. SB() and Driver() Managers) + pass # Variables initialized in respective plugins # Verify SeleniumBase is installed successfully, and used correctly if not hasattr(self, "browser"): @@ -14696,6 +14694,10 @@ def setUp(self, masterqa_mode=False): ) raise Exception(message) + if not hasattr(self, "is_nosetest") or not self.is_nosetest: + # Xvfb Virtual Display activation for Linux + self.__activate_virtual_display_as_needed() + # Dashboard pre-processing: if self.dashboard: if self._multithreaded: diff --git a/seleniumbase/plugins/driver_manager.py b/seleniumbase/plugins/driver_manager.py index 4530bf710d6..0041da03dd4 100644 --- a/seleniumbase/plugins/driver_manager.py +++ b/seleniumbase/plugins/driver_manager.py @@ -620,8 +620,24 @@ def Driver( elif browser not in ["chrome", "edge"]: headless2 = False # Only for Chromium browsers if disable_csp is None: - disable_csp = False + if ( + "--disable-csp" in sys_argv + or "--no-csp" in sys_argv + or "--dcsp" in sys_argv + ): + disable_csp = True + else: + disable_csp = False if ( + (enable_ws is None and disable_ws is None) + and ( + "--disable-web-security" in sys_argv + or "--disable-ws" in sys_argv + or "--dws" in sys_argv + ) + ): + enable_ws = False + elif ( (enable_ws is None and disable_ws is None) or (disable_ws is not None and not disable_ws) or (enable_ws is not None and enable_ws) diff --git a/seleniumbase/plugins/pytest_plugin.py b/seleniumbase/plugins/pytest_plugin.py index 868e051cd4c..f251c5170ab 100644 --- a/seleniumbase/plugins/pytest_plugin.py +++ b/seleniumbase/plugins/pytest_plugin.py @@ -1021,6 +1021,7 @@ def pytest_addoption(parser): parser.addoption( "--disable_ws", "--disable-ws", + "--dws", "--disable-web-security", action="store_true", dest="disable_ws", diff --git a/seleniumbase/plugins/sb_manager.py b/seleniumbase/plugins/sb_manager.py index ad2c3efb785..4fb800e71b5 100644 --- a/seleniumbase/plugins/sb_manager.py +++ b/seleniumbase/plugins/sb_manager.py @@ -711,8 +711,25 @@ def SB( else: variables = {} if disable_csp is None: - disable_csp = False + if ( + "--disable-csp" in sys_argv + or "--no-csp" in sys_argv + or "--dcsp" in sys_argv + ): + disable_csp = True + else: + disable_csp = False if ( + (enable_ws is None and disable_ws is None) + and ( + "--disable-web-security" in sys_argv + or "--disable-ws" in sys_argv + or "--dws" in sys_argv + ) + ): + enable_ws = False + disable_ws = True + elif ( (enable_ws is None and disable_ws is None) or (disable_ws is not None and not disable_ws) or (enable_ws is not None and enable_ws) diff --git a/seleniumbase/plugins/selenium_plugin.py b/seleniumbase/plugins/selenium_plugin.py index b9ae52ba4ef..149b7084a87 100644 --- a/seleniumbase/plugins/selenium_plugin.py +++ b/seleniumbase/plugins/selenium_plugin.py @@ -739,6 +739,7 @@ def options(self, parser, env): parser.addoption( "--disable_ws", "--disable-ws", + "--dws", "--disable-web-security", action="store_true", dest="disable_ws", diff --git a/setup.py b/setup.py index 98577221ae6..b25d804f505 100755 --- a/setup.py +++ b/setup.py @@ -163,7 +163,7 @@ "sbvirtualdisplay>=1.3.0", "six>=1.16.0", 'parse>=1.20.2', - 'parse-type>=0.6.3', + 'parse-type>=0.6.4', 'colorama>=0.4.6', 'pyyaml>=6.0.2', 'pygments>=2.18.0', @@ -204,7 +204,7 @@ 'python-xlib==0.33;platform_system=="Linux"', 'markdown-it-py==3.0.0', 'mdurl==0.1.2', - 'rich==13.9.1', + 'rich==13.9.2', ], extras_require={ # pip install -e .[allure]