Skip to content

Commit 94e80e4

Browse files
authored
Merge pull request #1668 from seleniumbase/bug-fixes-and-updates-2
Bug fixes and updates
2 parents 8d72faf + d338589 commit 94e80e4

File tree

13 files changed

+237
-117
lines changed

13 files changed

+237
-117
lines changed

.github/workflows/python-package.yml

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,16 @@ jobs:
4040
pip install flake8
4141
# Stop the build if there are flake8 issues
4242
flake8 . --count --show-source --statistics --exclude=temp
43-
- name: Install Chrome and Firefox
43+
- name: Install Chrome
4444
run: |
4545
sudo apt install google-chrome-stable
46-
sudo apt-get install firefox
4746
- name: Check the console scripts interface
4847
run: |
4948
seleniumbase
5049
sbase
51-
- name: Install chromedriver and geckodriver (Firefox Webdriver)
50+
- name: Install chromedriver
5251
run: |
5352
seleniumbase install chromedriver
54-
seleniumbase install geckodriver
5553
- name: Make sure pytest is working
5654
run: |
5755
echo "def test_1(): pass" > nothing.py
@@ -87,12 +85,6 @@ jobs:
8785
- name: Run pytest examples/test_inspect_html.py --browser=chrome --headless
8886
run: |
8987
pytest examples/test_inspect_html.py --browser=chrome --headless -v -s --junit-xml=junit/test-results.xml
90-
- name: Run pytest examples/test_mfa_login.py --browser=firefox --headless
91-
run: |
92-
pytest examples/test_mfa_login.py --browser=firefox --headless -v -s --junit-xml=junit/test-results.xml
93-
- name: Run pytest examples/test_mfa_login.py --browser=firefox --xvfb
94-
run: |
95-
pytest examples/test_mfa_login.py --browser=firefox --xvfb -v -s --junit-xml=junit/test-results.xml
9688
- name: Run behave examples/behave_bdd/features/calculator.feature -D rs -D crumbs -D xvfb
9789
run: |
9890
behave examples/behave_bdd/features/calculator.feature -D rs -D crumbs -D xvfb -T -k

examples/test_download_files.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,7 @@ def test_download_files_from_pypi(self):
4141
self.browser == "safari"
4242
or self.browser == "ie"
4343
or (self.is_chromium() and self.guest_mode and not self.headless)
44-
or (
45-
self.browser == "chrome"
46-
and self.is_chromedriver_too_old()
47-
and self.headless
48-
)
44+
or (self.undetectable and (self.headless or self.headless2))
4945
):
5046
whl_href = self.get_attribute(whl_selector, "href")
5147
tar_href = self.get_attribute(tar_selector, "href")

examples/wordle_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,10 @@ def test_wordle(self):
7171
button = 'button[class*="oneAndAHalf"]'
7272
self.click(button)
7373
row = (
74-
'div[class*="lbzlf"] div[class*="Row-module"]:nth-of-type(%s) '
74+
'div[class*="Board"] div[class*="Row-module"]:nth-of-type(%s) '
7575
% num_attempts
7676
)
77-
tile = row + 'div:nth-child(%s) div[class*="module_tile__3ayIZ"]'
77+
tile = row + 'div:nth-child(%s) div[class*="module_tile__"]'
7878
self.wait_for_element(tile % "5" + '[data-state$="t"]')
7979
self.wait_for_element(tile % "5" + '[data-animation="idle"]')
8080
letter_status = []

mkdocs_build/requirements.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Minimum Python version: 3.8 (for generating docs only)
33

44
regex>=2022.10.31
5-
pkginfo>=1.9.3
5+
pkginfo>=1.9.6
66
docutils==0.19
77
python-dateutil==2.8.2
88
livereload==2.6.3
@@ -15,7 +15,7 @@ click==8.1.3
1515
zipp==3.11.0
1616
ghp-import==2.1.0
1717
readme-renderer==37.3
18-
pymdown-extensions==9.9
18+
pymdown-extensions==9.9.1
1919
importlib-metadata==6.0.0
2020
pipdeptree==2.3.3
2121
bleach==5.0.1
@@ -24,12 +24,12 @@ nltk==3.8.1
2424
tornado==6.2
2525
watchdog==2.2.1
2626
cairocffi==1.4.0
27-
cairosvg==2.5.2
27+
cairosvg==2.6.0
2828
cssselect2==0.7.0
2929
tinycss2==1.2.1
3030
defusedxml==0.7.1
3131
mkdocs==1.4.2
32-
mkdocs-material==9.0.2
32+
mkdocs-material==9.0.4
3333
mkdocs-exclude-search==0.6.4
3434
mkdocs-simple-hooks==0.1.5
3535
mkdocs-material-extensions==1.1.1

requirements.txt

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
pip>=21.3.1;python_version>="3.6" and python_version<"3.7"
22
pip>=22.3.1;python_version>="3.7"
33
packaging>=21.3;python_version>="3.6" and python_version<"3.7"
4-
packaging>=22.0;python_version>="3.7"
4+
packaging>=23.0;python_version>="3.7"
55
setuptools>=59.6.0;python_version>="3.6" and python_version<"3.7"
6-
setuptools>=65.6.3;python_version>="3.7"
6+
setuptools>=65.7.0;python_version>="3.7"
77
tomli>=1.2.3;python_version>="3.6" and python_version<"3.7"
88
tomli>=2.0.1;python_version>="3.7"
99
tqdm>=4.64.1
@@ -23,12 +23,12 @@ six==1.16.0
2323
idna==3.4;python_version>="3.6"
2424
chardet==4.0.0;python_version>="3.6" and python_version<"3.7"
2525
chardet==5.1.0;python_version>="3.7"
26-
charset-normalizer==2.0.12;python_version>="3.6" and python_version<"3.7"
27-
charset-normalizer==2.1.1;python_version>="3.7"
26+
charset-normalizer==2.0.12;python_version<"3.7"
27+
charset-normalizer==3.0.1;python_version>="3.7"
2828
urllib3==1.26.12;python_version<"3.7"
29-
urllib3==1.26.13;python_version>="3.7"
29+
urllib3==1.26.14;python_version>="3.7"
3030
requests==2.27.1;python_version<"3.7"
31-
requests==2.28.1;python_version>="3.7"
31+
requests==2.28.2;python_version>="3.7"
3232
requests-toolbelt==0.10.1
3333
nose==1.3.7
3434
sniffio==1.3.0;python_version>="3.7"
@@ -50,17 +50,20 @@ sortedcontainers==2.4.0
5050
fasteners==0.17.3;python_version>="3.6" and python_version<"3.7"
5151
fasteners==0.18;python_version>="3.7"
5252
execnet==1.9.0
53+
iniconfig==1.1.1;python_version<"3.7"
54+
iniconfig==2.0.0;python_version>="3.7"
5355
pluggy==1.0.0;python_version>="3.6"
5456
py==1.11.0;python_version>="3.6"
55-
pytest==7.0.1;python_version>="3.6" and python_version<"3.7"
57+
pytest==7.0.1;python_version<"3.7"
5658
pytest==7.2.0;python_version>="3.7"
5759
pytest-forked==1.4.0;python_version>="3.6"
5860
pytest-html==2.0.1;python_version>="3.6"
59-
pytest-metadata==1.11.0;python_version>="3.6" and python_version<"3.7"
61+
pytest-metadata==1.11.0;python_version<"3.7"
6062
pytest-metadata==2.0.4;python_version>="3.7"
6163
pytest-ordering==0.6
62-
pytest-rerunfailures==10.3;python_version>="3.6"
63-
pytest-xdist==2.5.0;python_version>="3.6" and python_version<"3.7"
64+
pytest-rerunfailures==10.3;python_version<"3.7"
65+
pytest-rerunfailures==11.0;python_version>="3.7"
66+
pytest-xdist==2.5.0;python_version<"3.7"
6467
pytest-xdist==3.1.0;python_version>="3.7"
6568
parameterized==0.8.1
6669
sbvirtualdisplay==1.1.1
@@ -86,13 +89,13 @@ cffi==1.15.1
8689
typing-extensions==4.1.1;python_version>="3.6" and python_version<"3.7"
8790
typing-extensions==4.4.0;python_version>="3.7" and python_version<"3.9"
8891
rich==12.6.0;python_version>="3.6" and python_version<"3.7"
89-
rich==13.0.0;python_version>="3.7" and python_version<"4.0"
92+
rich==13.0.1;python_version>="3.7" and python_version<"4.0"
9093

9194
# --- Testing Requirements --- #
9295
# ("pip install -r requirements.txt" also installs this, but "pip install -e ." won't.)
9396

9497
coverage==6.2;python_version>="3.6" and python_version<"3.7"
95-
coverage==7.0.3;python_version>="3.7"
98+
coverage==7.0.5;python_version>="3.7"
9699
pytest-cov==4.0.0;python_version>="3.6"
97100
flake8==5.0.4;python_version>="3.6" and python_version<"3.9"
98101
flake8==6.0.0;python_version>="3.9"

seleniumbase/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# seleniumbase package
2-
__version__ = "4.11.2"
2+
__version__ = "4.11.3"

seleniumbase/console_scripts/sb_install.py

Lines changed: 42 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@
5151
)
5252
):
5353
IS_ARM_MAC = True
54+
PLAT = sys.platform
55+
IS_WINDOWS = False
56+
if "win32" in PLAT or "win64" in PLAT or "x64" in PLAT or "x86" in PLAT:
57+
IS_WINDOWS = True
5458
DRIVER_DIR = os.path.dirname(os.path.realpath(drivers.__file__))
5559
LOCAL_PATH = "/usr/local/bin/" # On Mac and Linux systems
5660
DEFAULT_CHROMEDRIVER_VERSION = "72.0.3626.69" # (If can't find LATEST_STABLE)
@@ -249,7 +253,7 @@ def main(override=None, intel_for_uc=None):
249253
file_name = "chromedriver_mac64.zip"
250254
elif "linux" in sys_plat:
251255
file_name = "chromedriver_linux64.zip"
252-
elif "win32" in sys_plat or "win64" in sys_plat or "x64" in sys_plat:
256+
elif IS_WINDOWS:
253257
file_name = "chromedriver_win32.zip" # Works for win32 / win_x64
254258
if not get_latest and not get_v_latest and num_args < 4:
255259
get_latest = True
@@ -348,7 +352,7 @@ def main(override=None, intel_for_uc=None):
348352
file_name = "geckodriver-%s-linux64.tar.gz" % use_version
349353
else:
350354
file_name = "geckodriver-%s-linux32.tar.gz" % use_version
351-
elif "win32" in sys_plat or "win64" in sys_plat or "x64" in sys_plat:
355+
elif IS_WINDOWS:
352356
file_name = "geckodriver-%s-win64.zip" % use_version
353357
else:
354358
raise Exception(
@@ -546,6 +550,9 @@ def main(override=None, intel_for_uc=None):
546550
if not os.path.exists(downloads_folder):
547551
os.makedirs(downloads_folder)
548552

553+
driver_name = None # The name of the driver executable
554+
driver_contents = [] # The contents of the driver zip file
555+
549556
if headless_ie_exists:
550557
headless_ie_file_path = os.path.join(
551558
downloads_folder, headless_ie_file_name
@@ -641,10 +648,20 @@ def main(override=None, intel_for_uc=None):
641648
zip_file_path = file_path
642649
zip_ref = zipfile.ZipFile(zip_file_path, "r")
643650
contents = zip_ref.namelist()
644-
if len(contents) == 1:
645-
if name == "operadriver":
646-
raise Exception("Zip file for OperaDriver is missing content!")
651+
if (
652+
len(contents) >= 1
653+
and name in ["chromedriver", "uc_driver"]
654+
):
647655
for f_name in contents:
656+
if (
657+
name == "chromedriver"
658+
and (
659+
f_name == "chromedriver"
660+
or f_name == "chromedriver.exe"
661+
)
662+
):
663+
driver_name = f_name
664+
driver_contents = [driver_name]
648665
# Remove existing version if exists
649666
new_file = os.path.join(downloads_folder, str(f_name))
650667
if (
@@ -658,6 +675,8 @@ def main(override=None, intel_for_uc=None):
658675
if "Driver" in new_file or "driver" in new_file:
659676
if os.path.exists(new_file):
660677
os.remove(new_file) # Technically the old file now
678+
if driver_contents:
679+
contents = driver_contents
661680
print("Extracting %s from %s ..." % (contents, file_name))
662681
if intel_for_uc and IS_ARM_MAC:
663682
f_name = "uc_driver"
@@ -670,12 +689,30 @@ def main(override=None, intel_for_uc=None):
670689
zipinfo.filename = "uc_driver"
671690
zip_ref.extract(zipinfo, downloads_folder)
672691
contents = zip_ref.namelist()
692+
if driver_contents:
693+
contents = driver_contents
694+
elif name == "chromedriver":
695+
zipinfos = zip_ref.infolist()
696+
for zipinfo in zipinfos:
697+
if (
698+
zipinfo.filename == "chromedriver"
699+
or zipinfo.filename == "chromedriver.exe"
700+
):
701+
zip_ref.extract(zipinfo, downloads_folder)
702+
contents = zip_ref.namelist()
703+
if driver_contents:
704+
contents = driver_contents
673705
else:
674706
zip_ref.extractall(downloads_folder)
675707
zip_ref.close()
676708
os.remove(zip_file_path)
677709
print("%sUnzip Complete!%s\n" % (c2, cr))
678710
for f_name in contents:
711+
if intel_for_uc:
712+
if IS_WINDOWS:
713+
f_name = "uc_driver.exe"
714+
else:
715+
f_name = "uc_driver"
679716
new_file = os.path.join(downloads_folder, str(f_name))
680717
pr_file = c3 + new_file + cr
681718
print("The file [%s] was saved to:\n%s\n" % (f_name, pr_file))

seleniumbase/core/browser_launcher.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -986,6 +986,8 @@ def get_driver(
986986
if is_using_uc(undetectable, browser_name) and mobile_emulator:
987987
mobile_emulator = False
988988
user_agent = None
989+
if page_load_strategy and page_load_strategy.lower() == "none":
990+
settings.PAGE_LOAD_STRATEGY = "none"
989991
proxy_auth = False
990992
proxy_user = None
991993
proxy_pass = None

0 commit comments

Comments
 (0)