Skip to content

Commit dd04807

Browse files
authored
Merge branch 'trunk' into petesong/add-practice-example
2 parents 21c48d8 + 861cdfc commit dd04807

File tree

68 files changed

+1439
-811
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+1439
-811
lines changed

.github/workflows/js-examples.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,12 @@ jobs:
8282
if: matrix.release == 'stable'
8383
uses: actions/setup-node@v4
8484
with:
85-
node-version: '18.x'
85+
node-version: '22.x'
8686
- name: Setup Node Nightly
8787
if: matrix.release == 'nightly'
8888
uses: actions/setup-node@v4
8989
with:
90-
node-version: '18.x'
90+
node-version: '22.x'
9191
registry-url: 'https://npm.pkg.github.com'
9292
- name: Use Nightly package.json in Ubuntu/macOS
9393
if: matrix.release == 'nightly' && matrix.os != 'windows'

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@
187187
same "printed page" as the copyright notice for easier
188188
identification within third-party archives.
189189

190-
Copyright 2024 Software Freedom Conservancy (SFC)
190+
Copyright 2025 Software Freedom Conservancy (SFC)
191191

192192
Licensed under the Apache License, Version 2.0 (the "License");
193193
you may not use this file except in compliance with the License.

examples/java/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ repositories {
1111

1212
dependencies {
1313
testImplementation 'org.seleniumhq.selenium:selenium-java:4.27.0'
14-
testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.11.3'
14+
testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.11.4'
1515
}
1616

1717
test {

examples/java/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
<dependency>
4141
<groupId>org.junit.jupiter</groupId>
4242
<artifactId>junit-jupiter-engine</artifactId>
43-
<version>5.11.3</version>
43+
<version>5.11.4</version>
4444
<scope>test</scope>
4545
</dependency>
4646
<dependency>

examples/java/src/test/java/dev/selenium/bidirectional/webdriver_bidi/LogTest.java

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -27,21 +27,6 @@ public void setup() {
2727
driver = new FirefoxDriver(options);
2828
}
2929

30-
@Test
31-
public void jsErrors() {
32-
CopyOnWriteArrayList<ConsoleLogEntry> logs = new CopyOnWriteArrayList<>();
33-
34-
try (LogInspector logInspector = new LogInspector(driver)) {
35-
logInspector.onConsoleEntry(logs::add);
36-
}
37-
38-
driver.get("https://www.selenium.dev/selenium/web/bidi/logEntryAdded.html");
39-
driver.findElement(By.id("consoleLog")).click();
40-
41-
new WebDriverWait(driver, Duration.ofSeconds(5)).until(_d -> !logs.isEmpty());
42-
Assertions.assertEquals("Hello, world!", logs.get(0).getText());
43-
}
44-
4530
@Test
4631
void testListenToConsoleLog() throws ExecutionException, InterruptedException, TimeoutException {
4732
try (LogInspector logInspector = new LogInspector(driver)) {

examples/java/src/test/java/dev/selenium/drivers/HttpClientTest.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,30 @@ public void remoteWebDriverIgnoreSSL() throws Exception {
7070
driver.quit();
7171
}
7272

73+
@Test
74+
public void remoteWebDriverWithEmbedAuthUrl() throws Exception {
75+
ClientConfig clientConfig = ClientConfig.defaultConfig()
76+
.withRetries()
77+
.sslContext(createSSLContextWithCA(Path.of("src/test/resources/tls.crt").toAbsolutePath().toString()))
78+
.connectionTimeout(Duration.ofSeconds(300))
79+
.readTimeout(Duration.ofSeconds(3600))
80+
.version(HTTP_1_1.toString());
81+
ChromeOptions options = new ChromeOptions();
82+
options.setEnableDownloads(true);
83+
driver = RemoteWebDriver.builder()
84+
.oneOf(options)
85+
.address(embedAuthToUrl(gridUrl, "admin", "myStrongPassword"))
86+
.config(clientConfig)
87+
.build();
88+
driver.quit();
89+
}
90+
91+
private URL embedAuthToUrl(URL url, String username, String password) throws Exception {
92+
String userInfo = username + ":" + password;
93+
String urlWithAuth = url.getProtocol() + "://" + userInfo + "@" + url.getHost() + ":" + url.getPort() + url.getPath();
94+
return new URL(urlWithAuth);
95+
}
96+
7397
public static SSLContext createSSLContextWithCA(String caCertPath) throws Exception {
7498
FileInputStream fis = new FileInputStream(caCertPath);
7599
CertificateFactory cf = CertificateFactory.getInstance("X.509");

examples/java/src/test/java/dev/selenium/interactions/PrintOptionsTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import org.junit.jupiter.api.Test;
44
import org.openqa.selenium.print.PageMargin;
55
import org.openqa.selenium.print.PrintOptions;
6-
6+
import org.openqa.selenium.print.PageSize;
77
import dev.selenium.BaseChromeTest;
88

99
public class PrintOptionsTest extends BaseChromeTest {
@@ -31,8 +31,8 @@ public void TestSize()
3131
{
3232
driver.get("https://www.selenium.dev/");
3333
PrintOptions printOptions = new PrintOptions();
34-
printOptions.setScale(.50);
35-
double current_scale = printOptions.getScale();
34+
printOptions.setPageSize(new PageSize(27.94, 21.59)); // A4 size in cm
35+
double currentHeight = printOptions.getPageSize().getHeight(); // use getWidth() to retrieve width
3636
}
3737

3838
@Test
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package dev.selenium.selenium_manager;
2+
3+
import org.junit.jupiter.api.Test;
4+
import org.openqa.selenium.WebDriver;
5+
import org.openqa.selenium.chrome.ChromeDriver;
6+
7+
public class SeleniumManagerUsageDemo {
8+
9+
@Test
10+
public void testSetupWithoutManager() {
11+
System.setProperty("webdriver.chrome.driver", "/path/to/chromedriver");
12+
WebDriver driver = new ChromeDriver();
13+
driver.get("https://www.selenium.dev/documentation/selenium_manager/");
14+
driver.quit();
15+
}
16+
17+
@Test
18+
public void testSetupWithManager() {
19+
WebDriver driver = new ChromeDriver();
20+
driver.get("https://www.selenium.dev/documentation/selenium_manager/");
21+
driver.quit();
22+
}
23+
24+
}

0 commit comments

Comments
 (0)