Skip to content

Conversation

@DineshKumarRA
Copy link
Contributor

@DineshKumarRA DineshKumarRA commented Jan 19, 2025

User description

Thanks for contributing to Selenium!
A PR well described will help maintainers to quickly review and merge it

Before submitting your PR, please check our contributing guidelines.
Avoid large PRs, help reviewers by making them as simple and short as possible.

Description

Use tax.xz for Firefox package starting in version 135 in pinned browsers. The changes should fix the issue with pinned browsers and drivers PR.

Motivation and Context

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • I have read the contributing document.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

PR Type

Bug fix


Description

  • Updated Firefox Linux package URL logic for version 135 and above.

  • Ensured compatibility with .tar.xz format for newer Firefox versions.


Changes walkthrough 📝

Relevant files
Bug fix
pinned_browsers.py
Adjusted Firefox Linux URL logic for version 135+               

scripts/pinned_browsers.py

  • Modified firefox_linux function to handle version-specific URL logic.
  • Added conditional check for Firefox versions below and above 135.
  • Updated URL format to .tar.xz for versions 135 and above.
  • +6/-1     

    Need help?
  • Type /help how to ... in the comments thread for any question about Qodo Merge usage.
  • Check out the documentation for more information.
  • @qodo-merge-pro
    Copy link
    Contributor

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

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

    Version Parsing

    The version parsing assumes the version string can be split by dot and the first component is numeric. This may fail for non-standard version strings.

    if int(version.split(".")[0]) < 135:

    @qodo-merge-pro
    Copy link
    Contributor

    PR Code Suggestions ✨

    Explore these optional code suggestions:

    CategorySuggestion                                                                                                                                    Score
    Possible issue
    Add version parsing error handling

    Add error handling for version parsing to prevent crashes when version string is
    malformed or empty

    scripts/pinned_browsers.py [419]

    -if int(version.split(".")[0]) < 135:
    +if not version or not version.strip():
    +    raise ValueError("Firefox version cannot be empty")
    +try:
    +    major_version = int(version.split(".")[0])
    +    if major_version < 135:
    • Apply this suggestion
    Suggestion importance[1-10]: 8

    Why: The suggestion adds crucial error handling for version parsing, preventing potential runtime crashes when dealing with malformed version strings. This is important for application stability and better error reporting.

    8
    General
    Reduce URL string duplication

    Use string formatting with a common URL template to reduce code duplication and
    potential maintenance issues

    scripts/pinned_browsers.py [419-424]

    -if int(version.split(".")[0]) < 135:
    -    return "https://ftp.mozilla.org/pub/firefox/releases/%s/linux-x86_64/en-US/firefox-%s.tar.bz2" % (
    -    version, version)
    -else:
    -    return "https://ftp.mozilla.org/pub/firefox/releases/%s/linux-x86_64/en-US/firefox-%s.tar.xz" % (
    -    version, version)
    +extension = "tar.bz2" if int(version.split(".")[0]) < 135 else "tar.xz"
    +return f"https://ftp.mozilla.org/pub/firefox/releases/{version}/linux-x86_64/en-US/firefox-{version}.{extension}"
    • Apply this suggestion
    Suggestion importance[1-10]: 7

    Why: The suggestion effectively reduces code duplication by using a common URL template and f-strings, making the code more maintainable and less prone to errors when URL patterns need to be updated.

    7

    @DineshKumarRA
    Copy link
    Contributor Author

    @diemol @VietND96 This PR should fix the issue with 'Automated Browser Version Update' PR's

    Copy link
    Member

    @VietND96 VietND96 left a comment

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    Thank you for the fix!

    @VietND96 VietND96 merged commit 86f165e into SeleniumHQ:trunk Jan 19, 2025
    9 checks passed
    @DineshKumarRA DineshKumarRA deleted the pinned-browser-updated-for-linux-firefox branch January 19, 2025 21:04
    yahonda added a commit to yahonda/rails that referenced this pull request Feb 28, 2025
    This commit bumps the selenium-webdriver to 4.29.1 to address the following error:
    
    ```ruby
    $ cd actionpack
    $ bundle exec rake test
    ... snip ...
    
    2025-02-26 06:18:09 ERROR Selenium [:selenium_manager] Unsuccessful response (404 Not Found) for URL https://ftp.mozilla.org/pub/firefox/releases/135.0.1/linux-x86_64/en-US/firefox-135.0.1.tar.bz2
    2025-02-26 06:18:09 ERROR Selenium Exception occurred: Unsuccessful command executed: ["/home/vscode/.rbenv/versions/3.4.2/lib/ruby/gems/3.4.0/gems/selenium-webdriver-4.27.0/bin/linux/selenium-manager", "--browser", "firefox", "--language-binding", "ruby", "--output", "json"] - Code 65
    {"code" => 65, "message" => "Unsuccessful response (404 Not Found) for URL https://ftp.mozilla.org/pub/firefox/releases/135.0.1/linux-x86_64/en-US/firefox-135.0.1.tar.bz2", "driver_path" => "", "browser_path" => ""}
    ```
    
    Starting from Firefox 135.0, the binaries are  provided in XZ format, replacing the previous BZ2 one.
    
    https://www.mozilla.org/en-US/firefox/135.0/releasenotes/
    > Linux binaries are now provided in XZ format, replacing the previous BZ2 format, offering faster unpacking and smaller file sizes.
    
    ```
    % curl -s -o /dev/null -w "%{http_code}\n" https://ftp.mozilla.org/pub/firefox/releases/135.0.1/linux-x86_64/en-US/firefox-135.0.1.tar.bz2
    404
    
    % curl -s -o /dev/null -w "%{http_code}\n" https://ftp.mozilla.org/pub/firefox/releases/135.0.1/linux-x86_64/en-US/firefox-135.0.1.tar.xz
    200
    ```
    
    selenium-webdriver 4.28.0 supports this change. This commit bumps the latest one 4.29.1 since there is no reason to use the older one at Rails CI.
    SeleniumHQ/selenium#15115
    dkani pushed a commit to dkani/rails that referenced this pull request Mar 3, 2025
    This commit bumps the selenium-webdriver to 4.29.1 to address the following error:
    
    ```ruby
    $ cd actionpack
    $ bundle exec rake test
    ... snip ...
    
    2025-02-26 06:18:09 ERROR Selenium [:selenium_manager] Unsuccessful response (404 Not Found) for URL https://ftp.mozilla.org/pub/firefox/releases/135.0.1/linux-x86_64/en-US/firefox-135.0.1.tar.bz2
    2025-02-26 06:18:09 ERROR Selenium Exception occurred: Unsuccessful command executed: ["/home/vscode/.rbenv/versions/3.4.2/lib/ruby/gems/3.4.0/gems/selenium-webdriver-4.27.0/bin/linux/selenium-manager", "--browser", "firefox", "--language-binding", "ruby", "--output", "json"] - Code 65
    {"code" => 65, "message" => "Unsuccessful response (404 Not Found) for URL https://ftp.mozilla.org/pub/firefox/releases/135.0.1/linux-x86_64/en-US/firefox-135.0.1.tar.bz2", "driver_path" => "", "browser_path" => ""}
    ```
    
    Starting from Firefox 135.0, the binaries are  provided in XZ format, replacing the previous BZ2 one.
    
    https://www.mozilla.org/en-US/firefox/135.0/releasenotes/
    > Linux binaries are now provided in XZ format, replacing the previous BZ2 format, offering faster unpacking and smaller file sizes.
    
    ```
    % curl -s -o /dev/null -w "%{http_code}\n" https://ftp.mozilla.org/pub/firefox/releases/135.0.1/linux-x86_64/en-US/firefox-135.0.1.tar.bz2
    404
    
    % curl -s -o /dev/null -w "%{http_code}\n" https://ftp.mozilla.org/pub/firefox/releases/135.0.1/linux-x86_64/en-US/firefox-135.0.1.tar.xz
    200
    ```
    
    selenium-webdriver 4.28.0 supports this change. This commit bumps the latest one 4.29.1 since there is no reason to use the older one at Rails CI.
    SeleniumHQ/selenium#15115
    sandeepsuryaprasad pushed a commit to sandeepsuryaprasad/selenium that referenced this pull request Mar 23, 2025
    aguspe added a commit to aguspe/selenium that referenced this pull request Apr 22, 2025
    gryznar pushed a commit to gryznar/selenium that referenced this pull request May 17, 2025
    aguspe added a commit that referenced this pull request May 31, 2025
    * Add support for beta chrome
    
    * Remove chrome beta from test
    
    * Try by modified the pinned browsers
    
    * Fix formatting
    
    * Fix formatting
    
    * Fix formatting
    
    * Add chrome data
    
    * Add integration to run in chrome beta
    
    * Add guard for beta chrome
    
    * change test environment
    
    * update MODULE.bazel
    
    * Fix formatting issues
    
    * Add browsers
    
    * fix formatting offenses
    
    * Try beta chrome again
    
    * trying with chromedriver beta data
    
    * Fix reference error
    
    * Try updating the .bazelrc file
    
    * Correct typo
    
    * merge trunk
    
    * Starting addressing review comments
    
    * Use version to set the webdriver version
    
    * Add beta to tests
    
    * Fix format
    
    * Remove version env variable from firefox beta
    
    * Rollback env variable
    
    * Correct formatting
    
    * Revert "Use tax.xz for Firefox package starting in version 135 in pinned browsers (#15115)"
    
    This reverts commit 86f165e
    
    * Revert formatting changes
    
    * Update pinned browsers
    
    * Add download of beta_chrome on pinned browsers
    
    * Pinned browsers script automatically generates beta chrome
    
    * Fix formatting
    
    ---------
    
    Co-authored-by: Titus Fortner <[email protected]>
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Projects

    None yet

    Development

    Successfully merging this pull request may close these issues.

    2 participants