Skip to content

Commit 7a5f811

Browse files
committed
Handle an edge case for base Chromium
1 parent 189d3c7 commit 7a5f811

2 files changed

Lines changed: 25 additions & 2 deletions

File tree

seleniumbase/console_scripts/sb_install.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,15 @@ def main(override=None, intel_for_uc=None, force_uc=None):
554554
else:
555555
url_request = get_cft_latest_versions_per_milestone()
556556
if not force_cft and url_request.ok:
557-
fver = get_cft_latest_version_from_milestone(use_version)
557+
try:
558+
fver = get_cft_latest_version_from_milestone(
559+
use_version
560+
)
561+
except KeyError:
562+
use_version = str(int(use_version) - 1)
563+
fver = get_cft_latest_version_from_milestone(
564+
use_version
565+
)
558566
found_chromedriver = True
559567
use_version = str(fver)
560568
if use_version == latest_version:

seleniumbase/core/browser_launcher.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5245,6 +5245,15 @@ def get_local_driver(
52455245
or driver_version == "keep"
52465246
):
52475247
browser_driver_close_match = True
5248+
one_off_chromium = False
5249+
if (
5250+
hasattr(sb_config, "binary_location")
5251+
and sb_config.binary_location == "_chromium_"
5252+
):
5253+
with suppress(Exception):
5254+
one_off_chromium_ver = int(use_version.split(".")[0]) - 1
5255+
if one_off_chromium_ver == int(ch_driver_version):
5256+
one_off_chromium = True
52485257
# If not ARM MAC and need to use uc_driver (and it's missing),
52495258
# and already have chromedriver with the correct version,
52505259
# then copy chromedriver to uc_driver (and it'll get patched).
@@ -5276,25 +5285,31 @@ def get_local_driver(
52765285
and use_version != "latest" # Browser version detected
52775286
and (ch_driver_version or not local_ch_exists)
52785287
and (
5279-
use_version.split(".")[0] != ch_driver_version
5288+
(
5289+
use_version.split(".")[0] != ch_driver_version
5290+
and not one_off_chromium
5291+
)
52805292
or (
52815293
not local_ch_exists
52825294
and use_version.isnumeric()
52835295
and int(use_version) >= 115
52845296
and not browser_driver_close_match
5297+
and not one_off_chromium
52855298
)
52865299
)
52875300
)
52885301
or (
52895302
use_uc
52905303
and use_version != "latest" # Browser version detected
52915304
and uc_driver_version != use_version
5305+
and not one_off_chromium
52925306
)
52935307
or (
52945308
full_ch_driver_version # Also used for the uc_driver
52955309
and driver_version
52965310
and len(str(driver_version).split(".")) == 4
52975311
and full_ch_driver_version != driver_version
5312+
and not one_off_chromium
52985313
)
52995314
):
53005315
# chromedriver download needed in the seleniumbase/drivers dir

0 commit comments

Comments
 (0)