@@ -225,7 +225,7 @@ def chromedriver_on_path():
225
225
return None
226
226
227
227
228
- def get_uc_driver_version ():
228
+ def get_uc_driver_version (full = False ):
229
229
uc_driver_version = None
230
230
if os .path .exists (LOCAL_UC_DRIVER ):
231
231
try :
@@ -236,9 +236,13 @@ def get_uc_driver_version():
236
236
output = output .decode ("latin1" )
237
237
else :
238
238
output = output .decode ("utf-8" )
239
+ full_version = output .split (" " )[1 ]
239
240
output = output .split (" " )[1 ].split ("." )[0 ]
240
241
if int (output ) >= 72 :
241
- uc_driver_version = output
242
+ if full :
243
+ uc_driver_version = full_version
244
+ else :
245
+ uc_driver_version = output
242
246
except Exception :
243
247
pass
244
248
return uc_driver_version
@@ -2158,14 +2162,19 @@ def get_local_driver(
2158
2162
}
2159
2163
use_version = "latest"
2160
2164
major_edge_version = None
2165
+ saved_mev = None
2166
+ use_br_version_for_edge = False
2167
+ use_exact_version_for_edge = False
2161
2168
try :
2162
2169
if binary_location :
2163
2170
try :
2164
2171
major_edge_version = (
2165
2172
detect_b_ver .get_browser_version_from_binary (
2166
2173
binary_location
2167
2174
)
2168
- ).split ("." )[0 ]
2175
+ )
2176
+ saved_mev = major_edge_version
2177
+ major_edge_version = saved_mev .split ("." )[0 ]
2169
2178
if len (major_edge_version ) < 2 :
2170
2179
major_edge_version = None
2171
2180
except Exception :
@@ -2174,11 +2183,25 @@ def get_local_driver(
2174
2183
br_app = "edge"
2175
2184
major_edge_version = (
2176
2185
detect_b_ver .get_browser_version_from_os (br_app )
2177
- ).split ("." )[0 ]
2186
+ )
2187
+ saved_mev = major_edge_version
2188
+ major_edge_version = major_edge_version .split ("." )[0 ]
2178
2189
if int (major_edge_version ) < 80 :
2179
2190
major_edge_version = None
2191
+ elif int (major_edge_version ) >= 115 :
2192
+ if (
2193
+ driver_version == "browser"
2194
+ and saved_mev
2195
+ and len (saved_mev .split ("." )) == 4
2196
+ ):
2197
+ driver_version = saved_mev
2198
+ use_br_version_for_edge = True
2180
2199
except Exception :
2181
2200
major_edge_version = None
2201
+ if driver_version and "." in driver_version :
2202
+ use_exact_version_for_edge = True
2203
+ if use_br_version_for_edge :
2204
+ major_edge_version = saved_mev
2182
2205
if major_edge_version :
2183
2206
use_version = major_edge_version
2184
2207
edge_driver_version = None
@@ -2194,19 +2217,20 @@ def get_local_driver(
2194
2217
output = output .decode ("utf-8" )
2195
2218
if output .split (" " )[0 ] == "MSEdgeDriver" :
2196
2219
# MSEdgeDriver VERSION
2197
- output = output .split (" " )[1 ].split ("." )[0 ]
2220
+ output = output .split (" " )[1 ]
2221
+ if use_exact_version_for_edge :
2222
+ edge_driver_version = output .split (" " )[0 ]
2223
+ output = output .split ("." )[0 ]
2198
2224
elif output .split (" " )[0 ] == "Microsoft" :
2199
- # Microsoft Edge WebDriver VERSION
2200
- if (
2201
- "WebDriver 115.0" in output
2202
- and "115.0.1901.183" not in output
2203
- ):
2204
- edgedriver_upgrade_needed = True
2205
- output = output .split (" " )[3 ].split ("." )[0 ]
2225
+ output = output .split (" " )[3 ]
2226
+ if use_exact_version_for_edge :
2227
+ edge_driver_version = output .split (" " )[0 ]
2228
+ output = output .split ("." )[0 ]
2206
2229
else :
2207
2230
output = 0
2208
2231
if int (output ) >= 2 :
2209
- edge_driver_version = output
2232
+ if not use_exact_version_for_edge :
2233
+ edge_driver_version = output
2210
2234
if driver_version == "keep" :
2211
2235
driver_version = edge_driver_version
2212
2236
except Exception :
@@ -2639,16 +2663,20 @@ def get_local_driver(
2639
2663
)
2640
2664
use_version = "latest"
2641
2665
major_chrome_version = None
2666
+ saved_mcv = None
2642
2667
full_ch_version = None
2643
2668
full_ch_driver_version = None
2669
+ use_br_version_for_uc = False
2644
2670
try :
2645
2671
if chrome_options .binary_location :
2646
2672
try :
2647
2673
major_chrome_version = (
2648
2674
detect_b_ver .get_browser_version_from_binary (
2649
2675
chrome_options .binary_location ,
2650
2676
)
2651
- ).split ("." )[0 ]
2677
+ )
2678
+ saved_mcv = major_chrome_version
2679
+ major_chrome_version = saved_mcv .split ("." )[0 ]
2652
2680
if len (major_chrome_version ) < 2 :
2653
2681
major_chrome_version = None
2654
2682
except Exception :
@@ -2658,6 +2686,7 @@ def get_local_driver(
2658
2686
full_ch_version = (
2659
2687
detect_b_ver .get_browser_version_from_os (br_app )
2660
2688
)
2689
+ saved_mcv = full_ch_version
2661
2690
major_chrome_version = full_ch_version .split ("." )[0 ]
2662
2691
if int (major_chrome_version ) < 67 :
2663
2692
major_chrome_version = None
@@ -2667,6 +2696,15 @@ def get_local_driver(
2667
2696
):
2668
2697
# chromedrivers 2.41 - 2.46 could be swapped with 72
2669
2698
major_chrome_version = "72"
2699
+ elif int (major_chrome_version ) >= 115 :
2700
+ if (
2701
+ driver_version == "browser"
2702
+ and saved_mcv
2703
+ and len (saved_mcv .split ("." )) == 4
2704
+ ):
2705
+ driver_version = saved_mcv
2706
+ if is_using_uc (undetectable , browser_name ):
2707
+ use_br_version_for_uc = True
2670
2708
except Exception :
2671
2709
major_chrome_version = None
2672
2710
if major_chrome_version :
@@ -2717,7 +2755,11 @@ def get_local_driver(
2717
2755
disable_build_check = True
2718
2756
uc_driver_version = None
2719
2757
if is_using_uc (undetectable , browser_name ):
2720
- uc_driver_version = get_uc_driver_version ()
2758
+ if use_br_version_for_uc :
2759
+ uc_driver_version = get_uc_driver_version (full = True )
2760
+ full_ch_driver_version = uc_driver_version
2761
+ else :
2762
+ uc_driver_version = get_uc_driver_version ()
2721
2763
if multi_proxy :
2722
2764
sb_config .multi_proxy = True
2723
2765
if uc_driver_version and driver_version == "keep" :
@@ -2774,7 +2816,10 @@ def get_local_driver(
2774
2816
):
2775
2817
full_ch_v_p = full_ch_version .split ("." )[0 :2 ]
2776
2818
full_ch_driver_v_p = full_ch_driver_version .split ("." )[0 :2 ]
2777
- if full_ch_v_p == full_ch_driver_v_p :
2819
+ if (
2820
+ full_ch_v_p == full_ch_driver_v_p
2821
+ or driver_version == "keep"
2822
+ ):
2778
2823
browser_driver_close_match = True
2779
2824
# If not ARM MAC and need to use uc_driver (and it's missing),
2780
2825
# and already have chromedriver with the correct version,
@@ -2821,6 +2866,12 @@ def get_local_driver(
2821
2866
and use_version != "latest" # Browser version detected
2822
2867
and uc_driver_version != use_version
2823
2868
)
2869
+ or (
2870
+ full_ch_driver_version # Also used for the uc_driver
2871
+ and driver_version
2872
+ and len (str (driver_version ).split ("." )) == 4
2873
+ and full_ch_driver_version != driver_version
2874
+ )
2824
2875
):
2825
2876
# chromedriver download needed in the seleniumbase/drivers dir
2826
2877
from seleniumbase .console_scripts import sb_install
0 commit comments