Skip to content

Fix a Recorder bug, optimize things, and refresh dependencies #2321

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 6 commits into from
Nov 28, 2023
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1381,7 +1381,7 @@ pytest --reruns=1 --reruns-delay=1

<div><a href="https://github.com/seleniumbase/SeleniumBase/"><img src="https://seleniumbase.github.io/cdn/img/fancy_logo_14.png" title="SeleniumBase" width="240" /></a></div> <div><a href="https://seleniumbase.io"><img src="https://img.shields.io/badge/docs-seleniumbase.io-11BBAA.svg" alt="SeleniumBase Docs" /></a></div> <div><a href="https://github.com/seleniumbase/SeleniumBase"><img src="https://img.shields.io/badge/tested%20with-SeleniumBase-04C38E.svg" alt="Tested with SeleniumBase" /></a></div> <div><a href="https://github.com/seleniumbase/SeleniumBase/blob/master/LICENSE"><img src="https://img.shields.io/badge/license-MIT-22BBCC.svg" title="SeleniumBase" /></a> <a href="https://gitter.im/seleniumbase/SeleniumBase" target="_blank"><img src="https://img.shields.io/gitter/room/seleniumbase/SeleniumBase.svg" alt="Gitter chat"/></a></div>
<div><a href="https://pepy.tech/project/seleniumbase" target="_blank"><img src="https://static.pepy.tech/badge/seleniumbase" alt="SeleniumBase PyPI downloads" /></a></div>
<div><a href="https://github.com/seleniumbase/SeleniumBase"><img src="https://hits.dwyl.com/seleniumbase/hits.svg" alt="visitor badge"/></a> (since Sep 15, 2023)</div>
<div><a href="https://github.com/seleniumbase/SeleniumBase"><img src="https://hits.dwyl.com/seleniumbase/hits.svg" alt="visitor badge"/></a></div>
<div><a href="https://github.com/seleniumbase/SeleniumBase/stargazers"><img src="https://img.shields.io/github/stars/seleniumbase/seleniumbase.svg?color=19A57B" title="Stargazers" /></a></div>

--------
Expand Down
2 changes: 1 addition & 1 deletion help_docs/handling_iframes.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ To back out of all nested calls of that, use:
self.set_content_to_default()
```

🖼️ See [examples/iframe_tests.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/iframe_tests.py) for tests that use all available iframe commands.
🖼️ See [SeleniumBase/examples/iframe_tests.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/iframe_tests.py) for tests that use all available iframe commands.

--------

Expand Down
6 changes: 3 additions & 3 deletions mkdocs_build/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

regex>=2023.10.3
PyYAML>=6.0.1
pymdown-extensions>=10.4
pymdown-extensions>=10.5
pipdeptree>=2.13.1
python-dateutil>=2.8.2
Markdown==3.5.1
Expand All @@ -20,7 +20,7 @@ paginate==0.5.6
pyquery==2.0.0
readtime==3.0.0
mkdocs==1.5.3
mkdocs-material==9.4.8
mkdocs-material==9.4.14
mkdocs-exclude-search==0.6.5
mkdocs-simple-hooks==0.1.5
mkdocs-material-extensions==1.3
mkdocs-material-extensions==1.3.1
18 changes: 9 additions & 9 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
pip>=23.3.1
packaging>=23.2
setuptools>=68.0.0;python_version<"3.8"
setuptools>=68.2.2;python_version>="3.8"
wheel>=0.41.3
setuptools>=69.0.2;python_version>="3.8"
wheel>=0.42.0
attrs>=23.1.0
certifi>=2023.7.22
certifi>=2023.11.17
filelock>=3.12.2;python_version<"3.8"
filelock>=3.13.1;python_version>="3.8"
platformdirs>=4.0.0
parse>=1.19.1
parse>=1.20.0
parse-type>=0.6.2
six==1.16.0
idna==3.4
idna==3.6
chardet==5.2.0
charset-normalizer==3.3.2
urllib3>=1.26.18,<2;python_version<"3.10"
Expand Down Expand Up @@ -39,20 +39,20 @@ pytest==7.4.3
pytest-html==2.0.1
pytest-metadata==3.0.0
pytest-ordering==0.6
pytest-rerunfailures==12.0
pytest-xdist==3.4.0
pytest-rerunfailures==13.0
pytest-xdist==3.5.0
parameterized==0.9.0
sbvirtualdisplay==1.3.0
behave==1.2.6
soupsieve==2.4.1;python_version<"3.8"
soupsieve==2.5;python_version>="3.8"
beautifulsoup4==4.12.2
pygments==2.16.1
pygments==2.17.2
pyreadline3==3.4.1;platform_system=="Windows"
tabcompleter==1.3.0
pdbp==1.5.0
colorama==0.4.6
exceptiongroup==1.1.3
exceptiongroup==1.2.0
pyotp==2.9.0
markdown-it-py==2.2.0;python_version<"3.8"
markdown-it-py==3.0.0;python_version>="3.8"
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.21.4"
__version__ = "4.21.5"
14 changes: 9 additions & 5 deletions seleniumbase/console_scripts/sb_mkrec.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ def main():
force_gui = False
rec_behave = False

sys_executable = sys.executable
if " " in sys_executable:
sys_executable = "python"

if "linux" in sys.platform:
use_colors = False
c0, c1, c2, c5, c7, cr = set_colors(use_colors)
Expand Down Expand Up @@ -189,18 +193,18 @@ def main():
print(success)
run_cmd = None
if not start_page:
run_cmd = "%s -m pytest %s --rec -q -s" % (sys.executable, file_name)
run_cmd = "%s -m pytest %s --rec -q -s" % (sys_executable, file_name)
else:
run_cmd = "%s -m pytest %s --rec -q -s --url=%s" % (
sys.executable, file_name, start_page
sys_executable, file_name, start_page
)
if '"' not in start_page:
run_cmd = '%s -m pytest %s --rec -q -s --url="%s"' % (
sys.executable, file_name, start_page
sys_executable, file_name, start_page
)
elif "'" not in start_page:
run_cmd = "%s -m pytest %s --rec -q -s --url='%s'" % (
sys.executable, file_name, start_page
sys_executable, file_name, start_page
)
if use_edge:
run_cmd += " --edge"
Expand All @@ -217,7 +221,7 @@ def main():
recorded_filename = file_name[:-3] + "_rec.py"
recordings_dir = os.path.join(dir_name, "recordings")
recorded_file = os.path.join(recordings_dir, recorded_filename)
prefix = "%s -m " % sys.executable
prefix = "%s -m " % sys_executable
if " " not in recorded_file:
os.system("%sseleniumbase print %s -n" % (prefix, recorded_file))
elif '"' not in recorded_file:
Expand Down
11 changes: 7 additions & 4 deletions seleniumbase/console_scripts/sb_recorder.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@

sb_config.rec_subprocess_p = None
sb_config.rec_subprocess_used = False
sys_executable = sys.executable
if " " in sys_executable:
sys_executable = "python"
if sys.version_info <= (3, 7):
current_version = ".".join(str(ver) for ver in sys.version_info[:3])
raise Exception(
Expand Down Expand Up @@ -139,17 +142,17 @@ def do_recording(file_name, url, overwrite_enabled, use_chrome, window):
add_on = " --rec-behave"
command = (
"%s -m seleniumbase mkrec %s --url=%s --gui"
% (sys.executable, file_name, url)
% (sys_executable, file_name, url)
)
if '"' not in url:
command = (
'%s -m seleniumbase mkrec %s --url="%s" --gui'
% (sys.executable, file_name, url)
% (sys_executable, file_name, url)
)
elif "'" not in url:
command = (
"%s -m seleniumbase mkrec %s --url='%s' --gui"
% (sys.executable, file_name, url)
% (sys_executable, file_name, url)
)
if not use_chrome:
command += " --edge"
Expand Down Expand Up @@ -185,7 +188,7 @@ def do_playback(file_name, use_chrome, window, demo_mode=False):
'File "%s" does not exist in the current directory!' % file_name,
)
return
command = "%s -m pytest %s -q -s" % (sys.executable, file_name)
command = "%s -m pytest %s -q -s" % (sys_executable, file_name)
if shared_utils.is_linux():
command += " --gui"
if not use_chrome:
Expand Down
16 changes: 16 additions & 0 deletions seleniumbase/core/browser_launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -2874,6 +2874,22 @@ def get_local_driver(
driver_version = saved_mcv
if is_using_uc(undetectable, browser_name):
use_br_version_for_uc = True
if (
(headless or headless2)
and IS_WINDOWS
and major_chrome_version
and int(major_chrome_version) >= 117
and not is_using_uc(undetectable, browser_name)
and not (remote_debug or devtools or use_wire)
and not (proxy_string or multi_proxy or proxy_pac_url)
and (not chromium_arg or "debug" not in chromium_arg)
and (not servername or servername == "localhost")
):
# Hide the "DevTools listening on ..." message.
# https://bugs.chromium.org
# /p/chromedriver/issues/detail?id=4403#c35
# (Only when the remote debugging port is not needed.)
chrome_options.add_argument("--remote-debugging-pipe")
except Exception:
major_chrome_version = None
if major_chrome_version:
Expand Down
9 changes: 8 additions & 1 deletion seleniumbase/undetected/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,16 @@ def __init__(
language = "en-US"
options.add_argument("--lang=%s" % language)
if not options.binary_location:
options.binary_location = (
binary_location = (
browser_executable_path or find_chrome_executable()
)
if binary_location:
options.binary_location = binary_location
else:
# Improve the default error message in this situation.
# Setting options.binary_location to None results in:
# "TypeError: Binary Location Must be a String"
raise Exception("Chrome not found! Install it first!")
self._delay = constants.UC.RECONNECT_TIME
self.user_data_dir = user_data_dir
self.keep_user_data_dir = keep_user_data_dir
Expand Down
20 changes: 10 additions & 10 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,17 +134,17 @@
'pip>=23.3.1',
'packaging>=23.2',
'setuptools>=68.0.0;python_version<"3.8"',
'setuptools>=68.2.2;python_version>="3.8"',
'wheel>=0.41.3',
'setuptools>=69.0.2;python_version>="3.8"',
'wheel>=0.42.0',
'attrs>=23.1.0',
"certifi>=2023.7.22",
"certifi>=2023.11.17",
'filelock>=3.12.2;python_version<"3.8"',
'filelock>=3.13.1;python_version>="3.8"',
'platformdirs>=4.0.0',
'parse>=1.19.1',
'parse>=1.20.0',
'parse-type>=0.6.2',
"six==1.16.0",
"idna==3.4",
"idna==3.6",
'chardet==5.2.0',
'charset-normalizer==3.3.2',
'urllib3>=1.26.18,<2;python_version<"3.10"',
Expand Down Expand Up @@ -172,20 +172,20 @@
"pytest-html==2.0.1", # Newer ones had issues
'pytest-metadata==3.0.0',
"pytest-ordering==0.6",
'pytest-rerunfailures==12.0',
'pytest-xdist==3.4.0',
'pytest-rerunfailures==13.0',
'pytest-xdist==3.5.0',
'parameterized==0.9.0',
"sbvirtualdisplay==1.3.0",
"behave==1.2.6",
'soupsieve==2.4.1;python_version<"3.8"',
'soupsieve==2.5;python_version>="3.8"',
"beautifulsoup4==4.12.2",
'pygments==2.16.1',
'pygments==2.17.2',
'pyreadline3==3.4.1;platform_system=="Windows"',
"tabcompleter==1.3.0",
"pdbp==1.5.0",
'colorama==0.4.6',
'exceptiongroup==1.1.3',
'exceptiongroup==1.2.0',
'pyotp==2.9.0',
'markdown-it-py==2.2.0;python_version<"3.8"',
'markdown-it-py==3.0.0;python_version>="3.8"',
Expand Down Expand Up @@ -230,7 +230,7 @@
"pdfminer": [
'pdfminer.six==20221105',
'cryptography==39.0.2;python_version<"3.9"',
'cryptography==41.0.5;python_version>="3.9"',
'cryptography==41.0.7;python_version>="3.9"',
'cffi==1.15.1;python_version<"3.8"',
'cffi==1.16.0;python_version>="3.8"',
"pycparser==2.21",
Expand Down