Skip to content

Commit 101bd16

Browse files
authored
Merge pull request #2020 from seleniumbase/more-uc-mode-refactoring
More UC Mode refactoring
2 parents 369ab50 + d4d00e2 commit 101bd16

File tree

4 files changed

+22
-18
lines changed

4 files changed

+22
-18
lines changed

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.17.10"
2+
__version__ = "4.17.11"

seleniumbase/core/browser_launcher.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -855,11 +855,11 @@ def _set_chrome_options(
855855
if is_using_uc(undetectable, browser_name):
856856
chrome_options.add_argument("--disable-application-cache")
857857
chrome_options.add_argument("--disable-setuid-sandbox")
858-
if is_using_uc(undetectable, browser_name) and not binary_location:
859-
br_app = "google-chrome"
860-
binary_loc = detect_b_ver.get_binary_location(br_app, True)
861-
if os.path.exists(binary_loc):
862-
binary_location = binary_loc
858+
if not binary_location:
859+
br_app = "google-chrome"
860+
binary_loc = detect_b_ver.get_binary_location(br_app, True)
861+
if os.path.exists(binary_loc):
862+
binary_location = binary_loc
863863
if chromium_arg:
864864
# Can be a comma-separated list of Chromium args
865865
chromium_arg_list = chromium_arg.split(",")

seleniumbase/core/detect_b_ver.py

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -99,18 +99,22 @@ def linux_browser_apps_to_cmd(*apps):
9999
def chrome_on_linux_path(prefer_chromium=False):
100100
if os_name() != "linux":
101101
return ""
102-
primary_chrome = "google-chrome"
103-
secondary_chrome = "chromium"
104102
if prefer_chromium:
105-
primary_chrome = "chromium"
106-
secondary_chrome = "google-chrome"
103+
paths = ["/bin/chromium", "/bin/chromium-browser"]
104+
for path in paths:
105+
if os.path.exists(path) and os.access(path, os.X_OK):
106+
return path
107+
paths = ["/bin/google-chrome", "/bin/google-chrome-stable"]
108+
for path in paths:
109+
if os.path.exists(path) and os.access(path, os.X_OK):
110+
return path
107111
paths = os.environ["PATH"].split(os.pathsep)
108112
binaries = []
109-
binaries.append(primary_chrome)
110-
binaries.append(secondary_chrome)
111-
binaries.append("chromium-browser")
112-
binaries.append("chrome")
113+
binaries.append("google-chrome")
113114
binaries.append("google-chrome-stable")
115+
binaries.append("chrome")
116+
binaries.append("chromium")
117+
binaries.append("chromium-browser")
114118
binaries.append("google-chrome-beta")
115119
binaries.append("google-chrome-dev")
116120
binaries.append("google-chrome-unstable")
@@ -243,10 +247,10 @@ def get_browser_version_from_os(browser_type):
243247
ChromeType.GOOGLE: {
244248
OSType.LINUX: linux_browser_apps_to_cmd(
245249
"google-chrome",
250+
"google-chrome-stable",
251+
"chrome",
246252
"chromium",
247253
"chromium-browser",
248-
"chrome",
249-
"google-chrome-stable",
250254
"google-chrome-beta",
251255
"google-chrome-dev",
252256
"google-chrome-unstable",

seleniumbase/fixtures/constants.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -361,10 +361,10 @@ class ValidBrowsers:
361361
class ValidBinaries:
362362
valid_chrome_binaries_on_linux = [
363363
"google-chrome",
364+
"google-chrome-stable",
365+
"chrome",
364366
"chromium",
365367
"chromium-browser",
366-
"chrome",
367-
"google-chrome-stable",
368368
"google-chrome-beta",
369369
"google-chrome-dev",
370370
"google-chrome-unstable",

0 commit comments

Comments
 (0)