Skip to content

Update to Selenium 4.33.0 +semver:feature #150

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 6 commits into from
Jun 11, 2025

Conversation

mialeska
Copy link
Contributor

No description provided.

@mialeska mialeska self-assigned this May 28, 2025
@mialeska mialeska added enhancement New feature or request dependencies Pull requests that update a dependency file labels May 28, 2025
@github-project-automation github-project-automation bot moved this to In progress in Aquality Selenium May 28, 2025
Copy link

coderabbitai bot commented May 28, 2025

Walkthrough

The Maven dependency aquality-selenium-core was updated from version 4.5.0 to 4.6.0. Selenium DevTools protocol imports were upgraded from versions 85 and 132 to version 137 across multiple classes. Corresponding method signatures were adjusted to match the updated DevTools API, including additional optional parameters in emulation, network, and runtime commands. The ManyToolsForm class was enhanced with a new button field and logic to handle it during page opening. The ChallengingDomForm and LocatorTests classes were refactored to use dynamic cell retrieval and improved locator handling. No other public API changes were made.

Changes

File(s) Change Summary
pom.xml Updated aquality-selenium-core dependency from 4.5.0 to 4.6.0
src/main/java/aquality/selenium/browser/devtools/* Updated Selenium DevTools imports from v85 to v137; adjusted method calls to match new API signatures including additional optional parameters in EmulationHandling, NetworkHandling, and JavaScriptHandling classes
src/test/java/tests/usecases/devtools/* Updated DevTools imports from v132/v85 to v137 with no other changes
src/test/java/manytools/ManyToolsForm.java Added private button field btnAgree; enhanced open() method to click btnAgree if displayed, waiting for its disappearance
src/test/java/automationpractice/forms/ChallengingDomForm.java Refactored to remove hardcoded cell locators and labels; added generic getCell(int, int) method; replaced header label method
src/test/java/tests/integration/LocatorTests.java Refactored to use dynamic cell retrieval and By locators; replaced hardcoded locators; added retry logic for image-based element detection; improved assertion messages and locator consistency

Poem

🐇 A hop, a skip, a version leap,
DevTools updated, no time to sleep!
From eighty-five to one-thirty-seven,
Our code now dances, light as heaven.
New options added, parameters wide,
In every call, we take the stride.
Onward we jump, with joy and pride! ✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 746acbb and e499142.

📒 Files selected for processing (2)
  • src/test/java/automationpractice/forms/ChallengingDomForm.java (1 hunks)
  • src/test/java/tests/integration/LocatorTests.java (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/test/java/tests/integration/LocatorTests.java
  • src/test/java/automationpractice/forms/ChallengingDomForm.java
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: aquality-automation.aquality-selenium-java (Run tests)
  • GitHub Check: aquality-automation.aquality-selenium-java (Analyse code with SonarQube)
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
pom.xml (1)

84-86: Verify dependency version bump aligns with Selenium upgrade plan.

The PR title refers to upgrading to Selenium 4.33.0, yet the aquality-selenium-core dependency was only bumped from 4.5.0 to 4.6.0. Please confirm that:

  1. Version 4.6.0 of aquality-selenium-core indeed pulls in Selenium 4.33.0 under the hood.
  2. No API changes in the new core version require code adjustments or additional tests.

Additionally, for better maintainability, consider moving <version>4.6.0</version> into a Maven property (e.g. ${aquality.selenium.core.version}) so it can be reused consistently across modules.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b55fc89 and 72306c3.

📒 Files selected for processing (1)
  • pom.xml (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: aquality-automation.aquality-selenium-java (Run tests)
  • GitHub Check: aquality-automation.aquality-selenium-java (Analyse code with SonarQube)

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 72306c3 and 3616258.

📒 Files selected for processing (7)
  • src/main/java/aquality/selenium/browser/devtools/DevToolsHandling.java (1 hunks)
  • src/main/java/aquality/selenium/browser/devtools/EmulationHandling.java (4 hunks)
  • src/main/java/aquality/selenium/browser/devtools/JavaScriptHandling.java (2 hunks)
  • src/main/java/aquality/selenium/browser/devtools/NetworkHandling.java (5 hunks)
  • src/test/java/tests/usecases/devtools/DeviceEmulationTest.java (1 hunks)
  • src/test/java/tests/usecases/devtools/NetworkSpeedEmulationTest.java (1 hunks)
  • src/test/java/tests/usecases/devtools/OverrideUserAgentTest.java (1 hunks)
✅ Files skipped from review due to trivial changes (5)
  • src/test/java/tests/usecases/devtools/NetworkSpeedEmulationTest.java
  • src/test/java/tests/usecases/devtools/DeviceEmulationTest.java
  • src/test/java/tests/usecases/devtools/OverrideUserAgentTest.java
  • src/main/java/aquality/selenium/browser/devtools/JavaScriptHandling.java
  • src/main/java/aquality/selenium/browser/devtools/DevToolsHandling.java
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: aquality-automation.aquality-selenium-java (Run tests)
  • GitHub Check: aquality-automation.aquality-selenium-java (Analyse code with SonarQube)
🔇 Additional comments (9)
src/main/java/aquality/selenium/browser/devtools/NetworkHandling.java (6)

11-11: LGTM! DevTools import updated correctly.

The import statement has been properly updated from the older version to v137, maintaining consistency with the Selenium 4.33.0 upgrade.


25-25: LGTM! Static import updated consistently.

The static import correctly references the v137 network class, maintaining consistency with the updated import on line 11.


29-29: LGTM! Javadoc reference updated correctly.

The documentation reference has been properly updated to point to the v137 version, ensuring documentation accuracy.


202-202: LGTM! Method call updated to use v137 API.

The getResponseBody method call correctly uses the v137 network class, maintaining consistency with the version upgrade.


343-343: LGTM! Additional Optional parameters added consistently.

The method call maintains the same pattern as line 326-327, correctly adding three additional Optional.empty() parameters while preserving the existing connectionType parameter logic.


326-327:

❓ Verification inconclusive

Verify the additional Optional parameters are correct.

The method signature has been updated with three additional Optional.empty() parameters. While this appears to follow the v137 API changes, please ensure these parameters correspond to the correct method signature.


🏁 Script executed:

#!/bin/bash
# Description: Verify the emulateNetworkConditions method signature in v137
# Expected: Find the method signature with the additional optional parameters

ast-grep --pattern 'emulateNetworkConditions($_, $_, $_, $_, $_, $_, $_, $_)'

Length of output: 807


🏁 Script executed:

#!/bin/bash
# Display the beginning of NetworkHandling.java to locate the emulateNetworkConditions method definition
sed -n '1,200p' src/main/java/aquality/selenium/browser/devtools/NetworkHandling.java

Length of output: 8051


Verify v137 emulateNetworkConditions signature

I see two invocations of emulateNetworkConditions in NetworkHandling.java that now supply eight arguments (four Optional.empty() placeholders):

  • Lines 326–327:
    tools.sendCommand(emulateNetworkConditions(
        offline, latency, downloadThroughput, uploadThroughput,
        Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty()));
  • Lines 342–343:
    tools.sendCommand(emulateNetworkConditions(
        offline, latency, downloadThroughput, uploadThroughput,
        Optional.of(ConnectionType.fromString(connectionType)),
        Optional.empty(), Optional.empty(), Optional.empty()));

Please confirm these four trailing Optional parameters match the updated v137 API signature for:

emulateNetworkConditions(
  Boolean offline,
  Number latency,
  Number downloadThroughput,
  Number uploadThroughput,
  Optional<ConnectionType> connectionType,
  Optional<?>      param6,
  Optional<?>      param7,
  Optional<?>      param8
)

Ensure each placeholder aligns with the intended CDP command parameters.

src/main/java/aquality/selenium/browser/devtools/EmulationHandling.java (3)

5-8: LGTM! DevTools protocol imports correctly upgraded.

The import statements have been properly updated from v85 to v137, which aligns with the PR objective of upgrading to Selenium 4.33.0. This change is consistent across the DevTools-related classes in the project.


48-49: LGTM! Backward compatibility maintained through proper delegation.

The existing 3-parameter setGeolocationOverride method now correctly delegates to the expanded 7-parameter version with empty optionals for the new parameters (altitude, altitudeAccuracy, heading, speed). This maintains backward compatibility while supporting the updated DevTools API.


68-72: LGTM! Method signature correctly expanded for DevTools v137 API.

The expanded method signature properly adds the four new optional parameters (altitude, altitudeAccuracy, heading, speed) required by the DevTools v137 setGeolocationOverride command. The implementation correctly passes all seven parameters to the underlying DevTools command.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
src/test/java/manytools/ManyToolsForm.java (2)

16-16: Consider making the XPath selector more specific.

The current XPath //button[@mode='primary'] is quite generic and could potentially match multiple primary buttons on a page, leading to unpredictable behavior.

Consider making the XPath more specific by adding additional attributes or context:

-    private final IButton btnAgree = getElementFactory().getButton(By.xpath("//button[@mode='primary']"), "Agree");
+    private final IButton btnAgree = getElementFactory().getButton(By.xpath("//button[@mode='primary' and contains(text(), 'Agree')]"), "Agree");

Or if you know the specific context where this button appears:

-    private final IButton btnAgree = getElementFactory().getButton(By.xpath("//button[@mode='primary']"), "Agree");
+    private final IButton btnAgree = getElementFactory().getButton(By.xpath("//div[contains(@class, 'consent')]//button[@mode='primary']"), "Agree");

29-33: Enhance robustness of the consent button handling.

The consent button handling logic is functionally correct, but could be made more robust to handle edge cases and potential race conditions.

Consider these improvements for better reliability:

-            if (btnAgree.state().isDisplayed())
-            {
-                btnAgree.click();
-                btnAgree.state().waitForNotDisplayed();
-            }
+            if (btnAgree.state().isDisplayed()) {
+                try {
+                    btnAgree.state().waitForClickable();
+                    btnAgree.click();
+                    btnAgree.state().waitForNotDisplayed();
+                } catch (TimeoutException e) {
+                    // Log and continue if consent button interaction fails
+                    AqualityServices.getLogger().info("Consent button interaction failed, continuing with page load");
+                }
+            }

This adds:

  • Explicit wait for clickability to avoid race conditions
  • Specific exception handling for consent button interactions
  • Logging for debugging purposes
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3616258 and 1af9784.

📒 Files selected for processing (1)
  • src/test/java/manytools/ManyToolsForm.java (3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: aquality-automation.aquality-selenium-java (Run tests)
  • GitHub Check: aquality-automation.aquality-selenium-java (Analyse code with SonarQube)
🔇 Additional comments (1)
src/test/java/manytools/ManyToolsForm.java (1)

5-5: Import addition looks good.

The import for IButton is correctly added to support the new button functionality.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (3)
src/test/java/automationpractice/forms/ChallengingDomForm.java (2)

11-13: Name constant does not match visible header – consider unifying for clarity

"Header of Challenging Dom" differs in case/spelling from the actual page text ("Challenging DOM").
Keeping the string identical to the UI copy (or extracting it into a constant shared with the locator) avoids brittle assertions and duplicate literals.
Example:

-        super(By.xpath(LOCATOR_CHALLENGING_DOM_FORM), "Header of Challenging Dom");
+        super(By.xpath(LOCATOR_CHALLENGING_DOM_FORM), "Challenging DOM header");

19-21: Guard against invalid indexes & over-broad XPath

The dynamic XPath //tr[%d]/td[%d] assumes 1-based positive indices and the first table on the page.
Adding simple pre-conditions and scoping the search to the intended table will prevent cryptic test failures when row <= 0, column <= 0, or another table is introduced.

 public ILabel getCell(int row, int column) {
-        return getElementFactory().getLabel(By.xpath(String.format("//tr[%d]/td[%d]", row, column)),
-                String.format("Cell at row %d and column %d", row, column));
+        if (row < 1 || column < 1) {
+            throw new IllegalArgumentException("Row and column must be 1-based and positive");
+        }
+        String xpath = String.format("(//table)[1]//tr[%d]/td[%d]", row, column);
+        return getElementFactory().getLabel(By.xpath(xpath),
+                String.format("Cell at row %d, column %d", row, column));
 }
src/test/java/tests/integration/LocatorTests.java (1)

68-94: Variable names don’t reflect expected row – lowers readability

actualCellRaw3Column5GotWith… is obtained with .above(cellInRow5Column5) which actually yields row 4, yet the helper variable and assertion message talk about row 3.
Misleading names slow future maintenance even if the logic still passes.

Rename the helpers (and similar occurrences below) or adjust the locator so that the name and content stay in sync.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1af9784 and 43df12e.

📒 Files selected for processing (2)
  • src/test/java/automationpractice/forms/ChallengingDomForm.java (1 hunks)
  • src/test/java/tests/integration/LocatorTests.java (4 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: aquality-automation.aquality-selenium-java (Analyse code with SonarQube)
  • GitHub Check: aquality-automation.aquality-selenium-java (Run tests)
🔇 Additional comments (1)
src/test/java/tests/integration/LocatorTests.java (1)

47-59: Refresh-loop may hide genuine failures

waitFor keeps refreshing the page until the element appears.
If the element never shows up, the test wastes time on full page reloads instead of failing fast.
Consider limiting the maximum number of retries or using the framework’s built-in timeout instead of manual refresh() to keep feedback tight.

@mialeska mialeska merged commit f04443e into master Jun 11, 2025
2 of 4 checks passed
@github-project-automation github-project-automation bot moved this from In progress to Done in Aquality Selenium Jun 11, 2025
@mialeska mialeska deleted the enhancement/update-to-selenium-4.33.0 branch June 11, 2025 06:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file enhancement New feature or request
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

1 participant