Skip to content

Update dependencies and refactor #3806

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ pip>=25.0.1;python_version<"3.9"
pip>=25.1.1;python_version>="3.9"
packaging>=25.0
setuptools~=70.2;python_version<"3.10"
setuptools>=80.8.0;python_version>="3.10"
setuptools>=80.9.0;python_version>="3.10"
wheel>=0.45.1
attrs>=25.3.0
certifi>=2025.4.26
Expand Down Expand Up @@ -35,7 +35,7 @@ chardet==5.2.0
charset-normalizer>=3.4.2,<4
urllib3>=1.26.20,<2;python_version<"3.10"
urllib3>=1.26.20,<2.5.0;python_version>="3.10"
requests==2.32.3
requests==2.32.4
sniffio==1.3.1
h11==0.16.0
outcome==1.3.0.post0
Expand All @@ -54,7 +54,8 @@ execnet==2.1.1
iniconfig==2.1.0
pluggy==1.5.0;python_version<"3.9"
pluggy==1.6.0;python_version>="3.9"
pytest==8.3.5
pytest==8.3.5;python_version<"3.9"
pytest==8.4.0;python_version>="3.9"
pytest-html==4.0.2
pytest-metadata==3.1.1
pytest-ordering==0.6
Expand Down
2 changes: 1 addition & 1 deletion seleniumbase/__version__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# seleniumbase package
__version__ = "4.39.2"
__version__ = "4.39.3"
18 changes: 9 additions & 9 deletions seleniumbase/fixtures/base_case.py
Original file line number Diff line number Diff line change
Expand Up @@ -4592,9 +4592,9 @@ def load_cookies(self, name="cookies.txt", expiry=False):
Loads the page cookies from the "saved_cookies" folder.
Usage for setting expiry:
If expiry == 0 or False: Delete "expiry".
If expiry is True: Set "expiry" to 24 hours in the future.
If expiry == -1 (or < 0): Do not modify "expiry".
If expiry > 0: Set "expiry" to expiry minutes in the future.
If expiry == True: Set "expiry" to 24 hours in the future.
"""
cookies = self.get_saved_cookies(name)
self.wait_for_ready_state_complete()
Expand All @@ -4606,12 +4606,12 @@ def load_cookies(self, name="cookies.txt", expiry=False):
cookie["domain"] = trim_origin
if "expiry" in cookie and (not expiry or expiry == 0):
del cookie["expiry"]
elif expiry is True:
cookie["expiry"] = int(time.time()) + 86400
elif isinstance(expiry, (int, float)) and expiry < 0:
pass
elif isinstance(expiry, (int, float)) and expiry > 0:
cookie["expiry"] = int(time.time()) + int(expiry * 60.0)
elif expiry:
cookie["expiry"] = int(time.time()) + 86400
self.driver.add_cookie(cookie)

def delete_all_cookies(self):
Expand Down Expand Up @@ -4693,9 +4693,9 @@ def add_cookie(self, cookie_dict, expiry=False):
self.add_cookie({'name': 'foo', 'value': 'bar', 'sameSite': 'Strict'})
Usage for setting expiry:
If expiry == 0 or False: Delete "expiry".
If expiry is True: Set "expiry" to 24 hours in the future.
If expiry == -1 (or < 0): Do not modify "expiry".
If expiry > 0: Set "expiry" to expiry minutes in the future.
If expiry == True: Set "expiry" to 24 hours in the future.
"""
self.__check_scope()
self._check_browser()
Expand All @@ -4707,21 +4707,21 @@ def add_cookie(self, cookie_dict, expiry=False):
cookie["domain"] = trim_origin
if "expiry" in cookie and (not expiry or expiry == 0):
del cookie["expiry"]
elif expiry is True:
cookie["expiry"] = int(time.time()) + 86400
elif isinstance(expiry, (int, float)) and expiry < 0:
pass
elif isinstance(expiry, (int, float)) and expiry > 0:
cookie["expiry"] = int(time.time()) + int(expiry * 60.0)
elif expiry:
cookie["expiry"] = int(time.time()) + 86400
self.driver.add_cookie(cookie_dict)

def add_cookies(self, cookies, expiry=False):
"""
Usage for setting expiry:
If expiry == 0 or False: Delete "expiry".
If expiry is True: Set "expiry" to 24 hours in the future.
If expiry == -1 (or < 0): Do not modify "expiry".
If expiry > 0: Set "expiry" to expiry minutes in the future.
If expiry == True: Set "expiry" to 24 hours in the future.
"""
self.__check_scope()
self._check_browser()
Expand All @@ -4733,12 +4733,12 @@ def add_cookies(self, cookies, expiry=False):
cookie["domain"] = trim_origin
if "expiry" in cookie and (not expiry or expiry == 0):
del cookie["expiry"]
elif expiry is True:
cookie["expiry"] = int(time.time()) + 86400
elif isinstance(expiry, (int, float)) and expiry < 0:
pass
elif isinstance(expiry, (int, float)) and expiry > 0:
cookie["expiry"] = int(time.time()) + int(expiry * 60.0)
elif expiry:
cookie["expiry"] = int(time.time()) + 86400
self.driver.add_cookie(cookie)

def __set_esc_skip(self):
Expand Down
13 changes: 11 additions & 2 deletions seleniumbase/plugins/pytest_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -2160,7 +2160,12 @@ def _perform_pytest_unconfigure_(config):
from seleniumbase.core import proxy_helper

reporter = config.pluginmanager.get_plugin("terminalreporter")
duration = time.time() - reporter._sessionstarttime
start_time = None
if hasattr(reporter, "_sessionstarttime"):
start_time = reporter._sessionstarttime # (pytest < 8.4.0)
else:
start_time = reporter._session_start.time # (pytest >= 8.4.0)
duration = time.time() - start_time
if (
(hasattr(sb_config, "multi_proxy") and not sb_config.multi_proxy)
or not hasattr(sb_config, "multi_proxy")
Expand Down Expand Up @@ -2497,7 +2502,11 @@ def pytest_unconfigure(config):
if "--co" in sys_argv or "--collect-only" in sys_argv:
return
reporter = config.pluginmanager.get_plugin("terminalreporter")
if not hasattr(reporter, "_sessionstarttime"):
if (
not hasattr(reporter, "_sessionstarttime")
and not hasattr(reporter, "_session_start")
and not hasattr(reporter._session_start, "time")
):
return
if hasattr(sb_config, "_multithreaded") and sb_config._multithreaded:
import fasteners
Expand Down
11 changes: 4 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,6 @@
os.system("python -m pip install --upgrade 'jaraco.classes'")
print("\n*** Installing more-itertools: *** (For PyPI uploads)\n")
os.system("python -m pip install --upgrade 'more-itertools'")
print("\n*** Installing zipp: *** (Required for PyPI uploads)\n")
os.system("python -m pip install --upgrade 'zipp'")
print("\n*** Installing importlib-metadata: *** (For PyPI uploads)\n")
os.system("python -m pip install --upgrade 'importlib-metadata'")
print("\n*** Installing keyring, requests-toolbelt: *** (For PyPI)\n")
os.system("python -m pip install --upgrade keyring requests-toolbelt")
print("\n*** Installing twine: *** (Required for PyPI uploads)\n")
Expand Down Expand Up @@ -153,7 +149,7 @@
'pip>=25.1.1;python_version>="3.9"',
'packaging>=25.0',
'setuptools~=70.2;python_version<"3.10"', # Newer ones had issues
'setuptools>=80.8.0;python_version>="3.10"',
'setuptools>=80.9.0;python_version>="3.10"',
'wheel>=0.45.1',
'attrs>=25.3.0',
"certifi>=2025.4.26",
Expand Down Expand Up @@ -186,7 +182,7 @@
'charset-normalizer>=3.4.2,<4',
'urllib3>=1.26.20,<2;python_version<"3.10"',
'urllib3>=1.26.20,<2.5.0;python_version>="3.10"',
'requests==2.32.3',
'requests==2.32.4',
'sniffio==1.3.1',
'h11==0.16.0',
'outcome==1.3.0.post0',
Expand All @@ -205,7 +201,8 @@
'iniconfig==2.1.0',
'pluggy==1.5.0;python_version<"3.9"',
'pluggy==1.6.0;python_version>="3.9"',
'pytest==8.3.5',
'pytest==8.3.5;python_version<"3.9"',
'pytest==8.4.0;python_version>="3.9"',
"pytest-html==4.0.2", # Newer ones had issues
'pytest-metadata==3.1.1',
"pytest-ordering==0.6",
Expand Down