Skip to content
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
4 changes: 2 additions & 2 deletions .github/workflows/ubuntu-selenium-java.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Set up JDK 11
- name: Set up JDK 25
uses: actions/setup-java@v3
with:
java-version: '11'
java-version: '25'
distribution: 'temurin'

- name: Run tests
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@ node_modules/
.cache/
.idea/
chromedriver.log
*.iml
/ubuntu-selenium-java/target/

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Move this to a .gitignore within the java folder?

.DS_Store
63 changes: 56 additions & 7 deletions ubuntu-selenium-java/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,30 @@

This repository provides a template for reproducing any ChromeDriver bug.

## Steps to Reproduce
## Your Goal

The test in `src/test/java/RegressionTest.java` follows these steps:
To use this template, extend the test case `ISSUE_REPRODUCTION` in
`src/test/java/RegressionTest.java` with steps that demonstrate the issue you are
investigating. Your aim should be to create a reproducible, minimal test case. Update
the test name accordingly.

1. Initializes a new Chrome browser session.
2. Navigates to a URL.
3. Asserts that the page title is correct.
## Overview

This sequence of actions fails with ChromeDriver 126, but works with 125.
The test `src/test/java/RegressionTest.java` performs the following actions:

1. **Environment Setup**: Automatically downloads a specific version of Chrome
(Stable by default) and the matching ChromeDriver binary.
2. **Test Execution**:
- The sample test navigates to `https://www.google.com`. You can modify this
test to add your specific reproduction steps.

## For local testing

- Have the appropriate version of Maven installed.
1. Install dependencies and run the tests:
```bash
mvn test
```

## Running the Tests

Expand All @@ -19,6 +34,40 @@ This sequence of actions fails with ChromeDriver 126, but works with 125.
mvn test
```

## Customizing the Test

Open `src/test/java/RegressionTest.java` and modify the provided test block to
include the steps required to reproduce your specific issue. Rename the test
accordingly.

```java
@Test
public void ISSUE_REPRODUCTION() {
// Add test reproducing the issue here.
driver.get("https://example.com");
// ... assertions and interactions
}
```

## GitHub Actions

The included GitHub Actions workflow in `.github/workflows/ubuntu-selenium-java.yml` will automatically run the tests on every push and pull request.
The included GitHub Actions workflow in
`.github/workflows/ubuntu-selenium-java.yml` will automatically run the tests on
every push and pull request.

## Automating Triage with Gemini CLI

The Gemini CLI can be used to automate the bug triaging process using the template
defined in GEMINI.md.

### Prerequisits

For Google internal users, consult internal documentation for exact MCP servers
required to access issue reports.

### Execution

Run gemini cli and prompt
```
Triage chromedriver bug <BUG_ID>
```
80 changes: 45 additions & 35 deletions ubuntu-selenium-java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,39 +15,49 @@
-->

<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.example</groupId>
<artifactId>ubuntu-selenium-java</artifactId>
<version>1.0-SNAPSHOT</version>

<licenses>
<license>
<name>Apache License, Version 2.0</name>
<url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses>

<properties>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
</properties>

<dependencies>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>4.22.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.10.2</version>
<scope>test</scope>
</dependency>
</dependencies>
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.example</groupId>
<artifactId>ubuntu-selenium-java</artifactId>
<version>1.0-SNAPSHOT</version>

<licenses>
<license>
<name>Apache License, Version 2.0</name>
<url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses>

<properties>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
</properties>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.2.5</version>
</plugin>
</plugins>
</build>

<dependencies>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>4.33.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.12.2</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
79 changes: 45 additions & 34 deletions ubuntu-selenium-java/src/test/java/RegressionTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,46 +14,57 @@
* limitations under the License.
*/

import static org.junit.jupiter.api.Assertions.assertEquals;

import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.chrome.ChromeDriverService;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.openqa.selenium.remote.http.ClientConfig;
import java.net.URL;
import java.time.Duration;
import java.util.HashMap;
import static org.junit.jupiter.api.Assertions.assertEquals;
import org.openqa.selenium.chrome.ChromeOptions;

public class RegressionTest {

@Test
public void shouldBeAbleToNavigateAfterDeletingNetworkConditions() {
ChromeOptions options = new ChromeOptions();
options.addArguments("--headless");
options.addArguments("--no-sandbox");

// By default, the test uses the latest stable Chrome version.
// Replace the "stable" with the specific browser version if needed,
// e.g. 'canary', '115' or '144.0.7534.0' for example.
options.setBrowserVersion("stable");

ChromeDriverService service = new ChromeDriverService.Builder()
.withLogFile(new java.io.File("chromedriver.log"))
.withVerbose(true)
.build();

WebDriver driver = new ChromeDriver(service, options);

try {
// Navigate to a URL
driver.get("https://www.google.com");

// Assert that the navigation was successful
assertEquals("Google", driver.getTitle());
} finally {
driver.quit();
}
private WebDriver driver;

@BeforeEach
public void setUp() {
ChromeOptions options = new ChromeOptions();
options.addArguments("--headless");
options.addArguments("--no-sandbox");

// By default, the test uses the latest stable Chrome version.
// Replace the "stable" with the specific browser version if needed,
// e.g. 'canary', '115' or '144.0.7534.0' for example.
options.setBrowserVersion("stable");

ChromeDriverService service =
new ChromeDriverService.Builder()
.withLogFile(new java.io.File("chromedriver.log"))
.withVerbose(true)
.build();

driver = new ChromeDriver(service, options);
}

@AfterEach
public void tearDown() {
if (driver != null) {
driver.quit();
}
}

@Test
public void verifySetup_shouldBeAbleToNavigateToGoogleCom() {
// Navigate to a URL
driver.get("https://www.google.com");
// Assert that the navigation was successful
assertEquals("Google", driver.getTitle());
}

@Test
public void ISSUE_REPRODUCTION() {
// Add test reproducing the issue here.
}
}