Skip to content

[rust] Test Selenium Manager on Linux arm64 #16045

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

Open
wants to merge 3 commits into
base: trunk
Choose a base branch
from

Conversation

dennisameling
Copy link

@dennisameling dennisameling commented Jul 12, 2025

User description

🔗 Related Issues

#15801

💥 What does this PR do?

This PR ensures that the Selenium Manager test suite passes on Linux arm64, and enables CI tests for this platform through GitHub's recently released Linux arm64 runners.

🔧 Implementation Notes

I'm new to Rust, but wanted Selenium Manager to explicitly fail if users try to run it for Chrome or Edge on Linux arm64, since it's not supported. Previously, the code would silently download linux64 binaries which are for Linux x64, and cause segfaults on Linux arm64.

The setup I went for at least ensures that Firefox/Geckodriver on Linux arm64 will work and are tested properly as well.

💡 Additional Considerations

🔄 Types of changes

  • New feature (non-breaking change which adds functionality and tests!)

PR Type

Enhancement


Description

  • Add Linux ARM64 support for Selenium Manager

  • Enable CI testing on GitHub's ARM64 runners

  • Restrict Chrome/Edge to Firefox-only on ARM64

  • Update test suite for ARM64 compatibility


Changes diagram

flowchart LR
  A["Linux ARM64 Detection"] --> B["Browser Support Check"]
  B --> C["Firefox: Supported"]
  B --> D["Chrome/Edge: Error"]
  E["Test Suite Updates"] --> F["ARM64 Conditional Logic"]
  G["CI Configuration"] --> H["GitHub ARM64 Runners"]
Loading

Changes walkthrough 📝

Relevant files
Error handling
2 files
chrome.rs
Add ARM64 unsupported error for Chrome                                     
+2/-0     
edge.rs
Add ARM64 unsupported error for Edge                                         
+3/-0     
Tests
11 files
browser_download_tests.rs
Skip non-Firefox tests on ARM64                                                   
+23/-16 
browser_tests.rs
Skip non-Firefox browser tests on ARM64                                   
+9/-0     
cache_tests.rs
Disable cache tests on ARM64                                                         
+1/-0     
config_tests.rs
Skip non-Firefox config tests on ARM64                                     
+5/-0     
exec_driver_tests.rs
Skip non-Firefox driver tests on ARM64                                     
+5/-0     
mirror_tests.rs
Use Firefox for ARM64 mirror tests                                             
+2/-2     
offline_tests.rs
Use Firefox for ARM64 offline tests                                           
+10/-5   
output_tests.rs
Use Firefox for ARM64 output tests                                             
+28/-13 
proxy_tests.rs
Use Firefox for ARM64 proxy tests                                               
+10/-4   
stable_browser_tests.rs
Skip non-Firefox stable tests on ARM64                                     
+6/-0     
webview_tests.rs
Disable webview tests on ARM64                                                     
+1/-0     
Enhancement
1 files
common.rs
Add ARM64 detection helper function                                           
+6/-0     
Configuration changes
1 files
ci-rust.yml
Add Ubuntu ARM64 runner to CI                                                       
+1/-0     

Need help?
  • Type /help how to ... in the comments thread for any questions about Qodo Merge usage.
  • Check out the documentation for more information.
  • Now that GitHub-hosted Linux arm64 runners are available,
    we can start using them to test the Selenium Manager code.
    Currently, only Firefox and Geckodriver have official support
    for Linux arm64. This commit ensures that the Selenium Manager
    test suite passes on this platform, by skipping tests on non-
    Firefox browsers.
    @selenium-ci selenium-ci added B-build Includes scripting, bazel and CI integrations C-rust Rust code is mostly Selenium Manager B-manager Selenium Manager labels Jul 12, 2025
    Copy link
    Contributor

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    🎫 Ticket compliance analysis 🔶

    15801 - Partially compliant

    Compliant requirements:

    • Enable CI builds for ARM64 systems (Linux arm64 CI added)
    • Support ARM-based systems (Linux arm64 support added)

    Non-compliant requirements:

    • Add official support for Windows ARM64 (WoA) platform (only Linux arm64 implemented)
    • Distribute native Selenium binaries for ARM64 (Windows ARM64 not addressed)
    • Support ARM-based Windows devices (Windows ARM64 not implemented)

    Requires further human verification:

    • Verify that Firefox/Geckodriver works correctly on Linux arm64 hardware
    • Confirm CI pipeline executes successfully on GitHub's arm64 runners
    • Test that error messages for unsupported browsers are user-friendly

    ⏱️ Estimated effort to review: 3 🔵🔵🔵⚪⚪
    🧪 PR contains tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Wrong Error Message

    The error message mentions "Google Chrome" when it should mention "Microsoft Edge" since this is in the Edge manager code.

        return Err(anyhow!("Linux arm64 is not supported yet by Google Chrome. Please try another browser."));
    } else {
    Logic Error

    The condition logic appears inverted - the original code skipped Edge on Windows, but the new code runs tests for Edge on Windows and skips other cases.

    if browser.eq("edge") && OS.eq("windows") {
      return
    } else if OS.eq("linux") && ARCH.eq("aarch64") && !browser.eq("firefox") {
      return
    }

    Copy link
    Contributor

    qodo-merge-pro bot commented Jul 12, 2025

    PR Code Suggestions ✨

    Explore these optional code suggestions:

    CategorySuggestion                                                                                                                                    Impact
    General
    Fix incorrect browser name in error

    The error message incorrectly mentions "Google Chrome" when this is the Edge
    browser manager. Update the error message to correctly reference Microsoft Edge
    instead of Chrome.

    rust/src/edge.rs [292-293]

     } else if LINUX.is(os) && ARM64.is(arch) {
    -    return Err(anyhow!("Linux arm64 is not supported yet by Google Chrome. Please try another browser."));
    +    return Err(anyhow!("Linux arm64 is not supported yet by Microsoft Edge. Please try another browser."));
    • Apply / Chat
    Suggestion importance[1-10]: 8

    __

    Why: This is a valid and important correction, as the error message in the EdgeManager incorrectly references "Google Chrome" due to a copy-paste error.

    Medium
    Add missing semicolons after return

    Add semicolons after the return statements to follow Rust conventions. While not
    required, explicit semicolons improve code consistency and readability.

    rust/tests/browser_download_tests.rs [31-35]

     if browser.eq("edge") && OS.eq("windows") {
    -  return
    +  return;
     } else if OS.eq("linux") && ARCH.eq("aarch64") && !browser.eq("firefox") {
    -  return
    +  return;
     }
    • Apply / Chat
    Suggestion importance[1-10]: 4

    __

    Why: The suggestion correctly points out that semicolons are missing, and adding them improves code style and consistency, which is a good practice in Rust.

    Low
    Add missing semicolon after return

    Add a semicolon after the return statement to follow Rust conventions and
    maintain consistency with other return statements in the codebase.

    rust/tests/browser_tests.rs [44-46]

     if OS.eq("linux") && ARCH.eq("aarch64") && !browser.eq("firefox") {
    -  return
    +  return;
     }
    • Apply / Chat
    Suggestion importance[1-10]: 4

    __

    Why: The suggestion correctly points out a missing semicolon after a return statement, and adding it improves code style and consistency with Rust conventions.

    Low
    • Update

    @cgoldberg
    Copy link
    Contributor

    Thanks. I'll leave code review for someone who knows rust.

    But I'm a little confused...

    Previously, the code would silently download linux64 binaries which are for Linux x64, and cause segfaults on Linux arm64.

    I thought we weren't building Selenium Manager on ARM. Were you running the linux64 binaries through QEMU or something?

    Does this PR enable building Selenium Manager for arm64, or just handle the situation when trying to run the linux64 binaries on arm64? If the former, don't we need to update the various bindings and packaging to accommodate this? ... or is this just a step towards enabling Selenium on ARM64?

    @dennisameling
    Copy link
    Author

    Sorry for the confusion here.

    I thought we weren't building Selenium Manager on ARM.

    Indeed. There have been no Selenium Manager builds for ARM. This PR is a step towards enabling Selenium on ARM64.

    The reason I mentioned linux64 is that if you look at this code path for example, without any changes for Linux ARM64, the code would just have downloaded the linux64 Chrome binary because it's in the else branch. But Linux ARM64 can't work with that natively, which is why I added this logic to explicitly tell the user that this scenario isn't supported until Chrome provides native binaries for this platform.

    This PR will at least ensure that users of Linux arm64 can use Firefox, which has official binaries for this platform 👍🏼 whenever Edge and Chrome start publishing native binaries too, they can be added through a follow-up PR.

    @cgoldberg
    Copy link
    Contributor

    OK... that makes sense, but it's probably more appropriate to make these changes if/when we start building SM for ARM since these code paths won't be tested or used until then.

    @dennisameling
    Copy link
    Author

    With regards to testing, that's why I added https://github.com/SeleniumHQ/selenium/pull/16045/files#diff-5162db340096b281e8c77ef016f0595e9b7a63e9cb48605a43b685301b4b5ee0R38 so that it will start running the tests on native Linux arm64 runners. GitHub released those in Public Preview in January of this year, and quite some open source projects have started using them already.

    I was hoping - by just adding the testing part to CI for now - that the team can at least be confident that the code will work on Linux arm64, and leave the actual builds/publishing for a follow-up PR. But happy to look into that part as well if helpful.

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    B-build Includes scripting, bazel and CI integrations B-manager Selenium Manager C-rust Rust code is mostly Selenium Manager Review effort 3/5
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    3 participants