Skip to content

[py] WIP - Support ARM binary selection for Selenium Manager #16052

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

Draft
wants to merge 8 commits into
base: trunk
Choose a base branch
from

Conversation

cgoldberg
Copy link
Contributor

@cgoldberg cgoldberg commented Jul 14, 2025

WIP - DO NOT MERGE

🔗 Related Issues

#15801

💥 What does this PR do?

Work is being done towards supporting ARM binaries for Selenium Manager (see: #15801, #16045, #16046). Once we begin publishing ARM64 binaries for Windows and Linux, the bindings will need to be updated to select the correct binary at runtime based on architecture.

This PR contains the updates to Python packaging and the Python bindings code to support this change.

💡 Additional Considerations

This PR assumes we are building/publishing new binaries named selenium-manager-arm64 (Linux) and selenium-manager-arm64.exe (Windows). It will need to be adapted to reflect whatever names are actually used when the work is done.

🔄 Types of changes

  • Build/Packaging
  • New feature

PR Type

Enhancement


Description

  • Add ARM64 binary support for Selenium Manager

  • Update binary selection logic for architecture detection

  • Modify build configuration for ARM64 binaries

  • Update packaging to include ARM64 executables


Changes diagram

flowchart LR
  A["Platform Detection"] --> B["Architecture Check"]
  B --> C["Binary Selection"]
  C --> D["ARM64 Binary"]
  C --> E["x86_64 Binary"]
  F["Build System"] --> G["Package ARM64 Binaries"]
Loading

Changes walkthrough 📝

Relevant files
Enhancement
selenium_manager.py
ARM64 binary selection logic implementation                           

py/selenium/webdriver/common/selenium_manager.py

  • Enhanced binary selection logic to support ARM64 architecture
  • Added platform-specific ARM64 binary paths for Windows and Linux
  • Updated architecture detection to use platform.machine().lower()
  • Extended allowed binary mappings for ARM64 support
  • +9/-3     
    Configuration changes
    BUILD.bazel
    Build configuration for ARM64 binaries                                     

    py/BUILD.bazel

  • Added copy rules for ARM64 Selenium Manager binaries
  • Created manager-linux-arm64 and manager-windows-arm64 targets
  • Updated build configuration to include ARM64 executables
  • +12/-0   
    pyproject.toml
    Package data configuration for ARM64                                         

    py/pyproject.toml

  • Added ARM64 binary files to package data
  • Included selenium-manager-arm64 and selenium-manager-arm64.exe
  • Updated packaging configuration for ARM64 support
  • +2/-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.
  • @cgoldberg cgoldberg marked this pull request as draft July 14, 2025 13:25
    @selenium-ci selenium-ci added C-py Python Bindings B-build Includes scripting, bazel and CI integrations labels Jul 14, 2025
    Copy link
    Contributor

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

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

    Architecture Mapping

    The architecture detection logic maps platform.machine() output to binary names, but ARM64 architectures can have different identifiers (aarch64, arm64, etc.). The current implementation only checks for 'arm64' which may not cover all ARM64 variants returned by platform.machine().

    arch = "any" if sys.platform == "darwin" else platform.machine().lower()
    if sys.platform in ["freebsd", "openbsd"]:
        logger.warning("Selenium Manager binary may not be compatible with %s; verify settings", sys.platform)
    
    location = allowed.get((sys.platform, arch))
    Missing Fallback

    The code removes the fallback mechanism for Windows platforms that previously used 'any' architecture. If ARM64 detection fails or returns an unexpected value, there's no fallback to the standard x86_64 binary, which could cause runtime failures.

        ("win32", "amd64"): "windows/selenium-manager.exe",
        ("win32", "arm64"): "windows/selenium-manager-arm64.exe",
        ("cygwin", "amd64"): "windows/selenium-manager.exe",
        ("cygwin", "arm64"): "windows/selenium-manager-arm64.exe",
        ("linux", "x86_64"): "linux/selenium-manager",
        ("linux", "arm64"): "linux/selenium-manager-arm64",
        ("freebsd", "x86_64"): "linux/selenium-manager",
        ("freebsd", "arm64"): "linux/selenium-manager-arm64",
        ("openbsd", "x86_64"): "linux/selenium-manager",
        ("openbsd", "arm64"): "linux/selenium-manager-arm64",
    }
    
    arch = "any" if sys.platform == "darwin" else platform.machine().lower()
    if sys.platform in ["freebsd", "openbsd"]:
        logger.warning("Selenium Manager binary may not be compatible with %s; verify settings", sys.platform)
    
    location = allowed.get((sys.platform, arch))

    Copy link
    Contributor

    PR Code Suggestions ✨

    Explore these optional code suggestions:

    CategorySuggestion                                                                                                                                    Impact
    Possible issue
    Normalize architecture detection values

    The architecture detection may fail on some systems where platform.machine()
    returns unexpected values. Add architecture normalization to handle common ARM64
    variants like 'aarch64' and 'arm64'.

    py/selenium/webdriver/common/selenium_manager.py [93]

     arch = "any" if sys.platform == "darwin" else platform.machine().lower()
    +# Normalize ARM64 architecture names
    +if arch in ("aarch64", "arm64"):
    +    arch = "arm64"
    +elif arch in ("x86_64", "amd64"):
    +    arch = "amd64" if sys.platform.startswith("win") else "x86_64"
    • Apply / Chat
    Suggestion importance[1-10]: 7

    __

    Why: The suggestion correctly identifies that platform.machine() can return different values for the same architecture (e.g., aarch64 vs arm64), and the proposed normalization makes the implementation more robust.

    Medium
    • More

    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 C-py Python Bindings Review effort 3/5
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    2 participants