Skip to content

More UC Mode refactoring #2020

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 2 commits into from
Aug 23, 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 seleniumbase/__version__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# seleniumbase package
__version__ = "4.17.10"
__version__ = "4.17.11"
10 changes: 5 additions & 5 deletions seleniumbase/core/browser_launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -855,11 +855,11 @@ def _set_chrome_options(
if is_using_uc(undetectable, browser_name):
chrome_options.add_argument("--disable-application-cache")
chrome_options.add_argument("--disable-setuid-sandbox")
if is_using_uc(undetectable, browser_name) and not binary_location:
br_app = "google-chrome"
binary_loc = detect_b_ver.get_binary_location(br_app, True)
if os.path.exists(binary_loc):
binary_location = binary_loc
if not binary_location:
br_app = "google-chrome"
binary_loc = detect_b_ver.get_binary_location(br_app, True)
if os.path.exists(binary_loc):
binary_location = binary_loc
if chromium_arg:
# Can be a comma-separated list of Chromium args
chromium_arg_list = chromium_arg.split(",")
Expand Down
24 changes: 14 additions & 10 deletions seleniumbase/core/detect_b_ver.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,18 +99,22 @@ def linux_browser_apps_to_cmd(*apps):
def chrome_on_linux_path(prefer_chromium=False):
if os_name() != "linux":
return ""
primary_chrome = "google-chrome"
secondary_chrome = "chromium"
if prefer_chromium:
primary_chrome = "chromium"
secondary_chrome = "google-chrome"
paths = ["/bin/chromium", "/bin/chromium-browser"]
for path in paths:
if os.path.exists(path) and os.access(path, os.X_OK):
return path
paths = ["/bin/google-chrome", "/bin/google-chrome-stable"]
for path in paths:
if os.path.exists(path) and os.access(path, os.X_OK):
return path
paths = os.environ["PATH"].split(os.pathsep)
binaries = []
binaries.append(primary_chrome)
binaries.append(secondary_chrome)
binaries.append("chromium-browser")
binaries.append("chrome")
binaries.append("google-chrome")
binaries.append("google-chrome-stable")
binaries.append("chrome")
binaries.append("chromium")
binaries.append("chromium-browser")
binaries.append("google-chrome-beta")
binaries.append("google-chrome-dev")
binaries.append("google-chrome-unstable")
Expand Down Expand Up @@ -243,10 +247,10 @@ def get_browser_version_from_os(browser_type):
ChromeType.GOOGLE: {
OSType.LINUX: linux_browser_apps_to_cmd(
"google-chrome",
"google-chrome-stable",
"chrome",
"chromium",
"chromium-browser",
"chrome",
"google-chrome-stable",
"google-chrome-beta",
"google-chrome-dev",
"google-chrome-unstable",
Expand Down
4 changes: 2 additions & 2 deletions seleniumbase/fixtures/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,10 +361,10 @@ class ValidBrowsers:
class ValidBinaries:
valid_chrome_binaries_on_linux = [
"google-chrome",
"google-chrome-stable",
"chrome",
"chromium",
"chromium-browser",
"chrome",
"google-chrome-stable",
"google-chrome-beta",
"google-chrome-dev",
"google-chrome-unstable",
Expand Down