Skip to content

Commit dfc8aa2

Browse files
committed
Merge branch 'master' of github.com:bonigarcia/webdrivermanager
2 parents 7e2810c + ed3b793 commit dfc8aa2

File tree

9 files changed

+123
-109
lines changed

9 files changed

+123
-109
lines changed

CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,23 @@
11
# Changelog
22

3+
## [5.2.2] - 2022-07-29
4+
5+
### Added
6+
- Include wait for Docker bind port
7+
- Include config key for Safari version (for WebKit version)
8+
9+
### Changed
10+
- Don't swallow exception root cause when creating a RemoteWebDriver (issue #873)
11+
- Method wdm.create() does not return null if failed to create a webdriver (issue #874)
12+
- Include port bindings in host config for docker containers
13+
14+
### Fixed
15+
- Check opera binary brower path only if not using Docker
16+
17+
### Removed
18+
- Documentation in EPUB format
19+
20+
321
## [5.2.1] - 2022-06-26
422

523
### Added

docs/index.html

Lines changed: 55 additions & 43 deletions
Large diffs are not rendered by default.

docs/webdrivermanager.pdf

3.48 KB
Binary file not shown.

pom.xml

Lines changed: 2 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33

44
<groupId>io.github.bonigarcia</groupId>
55
<artifactId>webdrivermanager</artifactId>
6-
<version>5.2.2-SNAPSHOT</version>
6+
<version>5.2.3-SNAPSHOT</version>
77

88
<properties>
99
<!-- compile -->
1010
<slf4j.version>1.7.36</slf4j.version>
11-
<gson.version>2.9.0</gson.version>
11+
<gson.version>2.9.1</gson.version>
1212
<docker-java.version>3.2.13</docker-java.version>
1313
<brotli.version>0.1.2</brotli.version>
1414
<commons-lang3.version>3.12.0</commons-lang3.version>
@@ -33,7 +33,6 @@
3333
<maven-jar-plugin.version>3.2.2</maven-jar-plugin.version>
3434
<maven-asciidoctor-plugin.version>2.2.2</maven-asciidoctor-plugin.version>
3535
<asciidoctorj-pdf.version>2.1.6</asciidoctorj-pdf.version>
36-
<asciidoctorj-epub3.version>1.5.1</asciidoctorj-epub3.version>
3736
<maven-site.version>3.12.0</maven-site.version>
3837
<maven-project-info-reports.version>3.4.0</maven-project-info-reports.version>
3938
<maven-javadoc-plugin.version>3.4.0</maven-javadoc-plugin.version>
@@ -285,11 +284,6 @@
285284
<artifactId>asciidoctorj-pdf</artifactId>
286285
<version>${asciidoctorj-pdf.version}</version>
287286
</dependency>
288-
<dependency>
289-
<groupId>org.asciidoctor</groupId>
290-
<artifactId>asciidoctorj-epub3</artifactId>
291-
<version>${asciidoctorj-epub3.version}</version>
292-
</dependency>
293287
</dependencies>
294288
<configuration>
295289
<sourceDirectory>src/doc/asciidoc</sourceDirectory>
@@ -354,33 +348,6 @@
354348
</attributes>
355349
</configuration>
356350
</execution>
357-
<execution>
358-
<id>asciidoc-to-epub</id>
359-
<phase>site</phase>
360-
<goals>
361-
<goal>process-asciidoc</goal>
362-
</goals>
363-
<configuration>
364-
<doctype>book</doctype>
365-
<backend>epub3</backend>
366-
<sourceDirectory>src/doc/asciidoc</sourceDirectory>
367-
<sourceDocumentName>index.adoc</sourceDocumentName>
368-
<outputFile>${project.artifactId}.epub</outputFile>
369-
<attributes>
370-
<source-highlighter>coderay</source-highlighter>
371-
<imagesdir>img</imagesdir>
372-
<pagenums />
373-
<toc />
374-
<idprefix />
375-
<idseparator>-</idseparator>
376-
<icons>font</icons>
377-
<sectnums />
378-
<lang>en</lang>
379-
<revnumber>${project.version}</revnumber>
380-
<revdate>${maven.build.timestamp}</revdate>
381-
</attributes>
382-
</configuration>
383-
</execution>
384351
</executions>
385352
</plugin>
386353
<plugin>

src/doc/asciidoc/index.adoc

Lines changed: 21 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,10 @@ Selenium WebDriver carries out the automation using the native support of each b
1515
image::selenium-webdriver-architecture.png[scaledwidth=100%]
1616

1717
ifndef::backend-pdf[]
18-
ifndef::backend-epub3[]
1918
++++
2019
include::carbon.html[]
2120
++++
2221
endif::[]
23-
endif::[]
2422

2523
From a practical point of view, we need to make a _driver management process_ to use Selenium WebDriver. This process consists on:
2624

@@ -372,7 +370,7 @@ mvn exec:java -Dexec.args="runInDocker chrome"
372370

373371
[source,shell,subs="attributes+"]
374372
----
375-
docker run --rm -it -v /var/run/docker.sock:/var/run/docker.sock -e ARGS="runInDocker chrome 91" bonigarcia/webdrivermanager:{project-version}
373+
docker run --rm -it -v /var/run/docker.sock:/var/run/docker.sock -e ARGS="runInDocker chrome" bonigarcia/webdrivermanager:{project-version}
376374
----
377375

378376
WARNING: There is an https://bugs.chromium.org/p/chromedriver/issues/detail?id=3857[open issue] with Chrome 92+ and Docker at the time of this writing. For this reason, the previous Docker container command uses Chrome 91. For further information, see <<known-issues, known issues>>.
@@ -411,6 +409,8 @@ The WebDriverManager Server is based on HTTP and offers two types of services. F
411409
* http://localhost:4444/operadriver[http://localhost:4444/operadriver]: To resolve geckodriver.
412410
* http://localhost:4444/iedriver[http://localhost:4444/iedriver]: To resolve geckodriver.
413411

412+
NOTE: You can parametrize these URLs using all the configuration keys available in WebDriverManager (see the <<advanced-configuration,advanced configuration>> section) as parameters, but removing the `wdm.` preffix. For instance, the URL for requesting the resolution of chromedriver for Chrome 100 would be http://localhost:4444/chromedriver?chromeVersion=100[http://localhost:4444/chromedriver?chromeVersion=100].
413+
414414
Second, the WebDriverManager Server acts as a regular Selenium Server (i.e., a _hub_ in the classical Selenium Grid architecture). This feature can create remote `WebDriver` instances using the WebDriverManager Server (even for different language bindings than Java). The following example shows a Node.js test using Selenium WebDriver and WebDriverManager Server (notice that by default, the WebDriverManager Server URL does not require any path, i.e., http://localhost:4444/[http://localhost:4444/]):
415415

416416
[source,javascript]
@@ -421,7 +421,7 @@ async function wdmServerTest() {
421421
var wdmServerUrl = "http://localhost:4444/";
422422
var capabilities = {
423423
browserName : "chrome",
424-
version: "91.0"
424+
version: "100"
425425
};
426426
427427
try {
@@ -523,26 +523,25 @@ boni@ubuntu:~$ java -jar webdrivermanager-{project-version}-fat.jar resolveDrive
523523
[INFO] Using WebDriverManager to resolve chrome
524524
[DEBUG] Detecting chrome version using online commands.properties
525525
[DEBUG] Running command on the shell: [google-chrome, --version]
526-
[DEBUG] Result: Google Chrome 92.0.4515.107
527-
[DEBUG] Latest version of chromedriver, according to https://chromedriver.storage.googleapis.com/LATEST_RELEASE_92 is 92.0.4515.107
528-
[INFO] Using chromedriver 92.0.4515.107 (resolved driver for Chrome 92)
526+
[DEBUG] Result: Google Chrome 103.0.5060.134
527+
[DEBUG] Latest version of chromedriver according to https://chromedriver.storage.googleapis.com/LATEST_RELEASE_103 is 103.0.5060.134
528+
[INFO] Using chromedriver 103.0.5060.134 (resolved driver for Chrome 103)
529529
[INFO] Reading https://chromedriver.storage.googleapis.com/ to seek chromedriver
530-
[DEBUG] Driver to be downloaded chromedriver 92.0.4515.107
531-
[INFO] Downloading https://chromedriver.storage.googleapis.com/92.0.4515.107/chromedriver_linux64.zip
530+
[DEBUG] Driver to be downloaded chromedriver 103.0.5060.134
531+
[INFO] Downloading https://chromedriver.storage.googleapis.com/103.0.5060.134/chromedriver_linux64.zip
532532
[INFO] Extracting driver from compressed file chromedriver_linux64.zip
533533
[INFO] Driver location: /home/boni/chromedriver
534534
535-
boni@ubuntu:~$ java -jar selenium-server-4.0.0-beta-4.jar standalone
536-
20:19:03.815 INFO [LoggingOptions.configureLogEncoding] - Using the system default encoding
537-
20:19:03.818 INFO [OpenTelemetryTracer.createTracer] - Using OpenTelemetry for tracing
538-
20:19:04.272 INFO [NodeOptions.getSessionFactories] - Detected 8 available processors
539-
20:19:04.284 INFO [NodeOptions.discoverDrivers] - Discovered 1 driver(s)
540-
20:19:04.296 INFO [NodeOptions.report] - Adding Chrome for {"browserName": "chrome","platformName": "LINUX"} 8 times
541-
20:19:04.310 INFO [Node.<init>] - Binding additional locator mechanisms: name, id
542-
20:19:04.322 INFO [LocalDistributor.add] - Added node 4651dc4d-3e07-43e7-b8d5-7368c95ea76d at http://172.17.0.1:4444.
543-
20:19:04.324 INFO [GridModel.setAvailability] - Switching node 4651dc4d-3e07-43e7-b8d5-7368c95ea76d (uri: http://172.17.0.1:4444) from DOWN to UP
544-
20:19:04.438 INFO [Standalone.execute] - Started Selenium Standalone 4.0.0-beta-4 (revision 29f46d02dd): http://172.17.0.1:4444
545-
535+
boni@ubuntu:~$ java -jar selenium-server-4.3.0.jar standalone
536+
01:31:52.806 INFO [LoggingOptions.configureLogEncoding] - Using the system default encoding
537+
01:31:52.810 INFO [OpenTelemetryTracer.createTracer] - Using OpenTelemetry for tracing
538+
01:31:53.344 INFO [NodeOptions.getSessionFactories] - Detected 16 available processors
539+
01:31:53.359 INFO [NodeOptions.discoverDrivers] - Discovered 1 driver(s)
540+
01:31:53.382 INFO [NodeOptions.report] - Adding Chrome for {"browserName": "chrome"} 16 times
541+
01:31:53.417 INFO [Node.<init>] - Binding additional locator mechanisms: id, relative, name
542+
01:31:53.436 INFO [GridModel.setAvailability] - Switching Node 3804a261-5889-44c5-8cb1-d56162cf39ef (uri: http://172.18.0.1:4444) from DOWN to UP
543+
01:31:53.436 INFO [LocalDistributor.add] - Added node 3804a261-5889-44c5-8cb1-d56162cf39ef at http://172.18.0.1:4444. Health check every 120s
544+
01:31:53.554 INFO [Standalone.execute] - Started Selenium Standalone 4.3.0 (revision a4995e2c09*): http://172.18.0.1:4444
546545
----
547546

548547
=== Appium
@@ -620,7 +619,7 @@ The remainder of this section describes all the possible Java methods in the Web
620619
|`cachePath(String)`|`wdm.cachePath`|`~/.cache/selenium`|Folder to store drivers locally
621620
|`resolutionCachePath(String)`|`wdm.resolutionCachePath`|`~/.cache/selenium`|Folder to store the resolution cache
622621
|`driverVersion(String)`|`wdm.chromeDriverVersion`, `wdm.operaDriverVersion`, `wdm.iExplorerDriverVersion`, `wdm.edgeDriverVersion`, `wdm.geckoDriverVersion`, `wdm.chromiumDriverVersion`|`""` (automatic driver version discovery through the <<resolution-algorithm,resolution algorithm>>)|Custom driver version
623-
|`browserVersion(String)`|`wdm.chromeVersion`, `wdm.operaVersion`, `wdm.edgeVersion`, `wdm.firefoxVersion`, `wdm.chromiumVersion`|`""` (automatic browser version detection using the https://github.com/bonigarcia/webdrivermanager/blob/master/src/main/resources/commands.properties[commands database])|Custom browser version (major)
622+
|`browserVersion(String)`|`wdm.chromeVersion`, `wdm.operaVersion`, `wdm.edgeVersion`, `wdm.firefoxVersion`, `wdm.chromiumVersion`, `wdm.safariVersion`|`""` (automatic browser version detection using the https://github.com/bonigarcia/webdrivermanager/blob/master/src/main/resources/commands.properties[commands database])|Custom browser version (major)
624623
|`forceDownload()`|`wdm.forceDownload=true`|`false` (drivers in cache are reused if available)|Force downloading driver (even if it is already in the cache)
625624
|`useBetaVersions()`|`wdm.useBetaVersions=true`|`false` (driver versions are skipped)|Allow the use beta versions (if possible)
626625
|`architecture(Architecture)`|`wdm.architecture`|`""` (automatic architecture discovery)|Force a given architecture for a driver
@@ -748,7 +747,6 @@ There are two ways to try to get community support related to WebDriverManager.
748747
https://opencollective.com/webdrivermanager[WebDriverManager] is part of https://opencollective.com/bonigarcia[OpenCollective], an online funding platform for open and transparent communities. You can support the project by contributing as a backer (i.e., a personal https://opencollective.com/webdrivermanager/donate[donation] or https://opencollective.com/webdrivermanager/contribute/backer-8132/checkout[recurring contribution]) or as a https://opencollective.com/webdrivermanager/contribute/sponsor-8133/checkout[sponsor] (i.e., a recurring contribution by a company).
749748

750749
ifndef::backend-pdf[]
751-
ifndef::backend-epub3[]
752750
[discrete]
753751
=== Backers
754752
++++
@@ -761,7 +759,6 @@ include::backers.html[]
761759
include::sponsors.html[]
762760
++++
763761
endif::[]
764-
endif::[]
765762

766763
== Further Documentation
767764
There are other resources related to Selenium-Jupiter and automated testing you can find helpful. For instance, the following books:
@@ -780,4 +777,4 @@ Or the following journal papers:
780777
* García, Boni, and Juan Carlos Dueñas. "https://www.rintonpress.com/journals/jweonline.html#v14n56[Web browsing automation for applications quality control]." _Journal of web engineering_ (2015): 474-502.
781778

782779
== About
783-
WebDriverManager (Copyright © 2015-2022) is an open-source project created and maintained by https://bonigarcia.dev/[Boni García] (https://twitter.com/boni_gg[@boni_gg]), licensed under the terms of https://www.apache.org/licenses/LICENSE-2.0[Apache 2.0 License]. This documentation (also available in link:webdrivermanager.pdf[PDF] and link:webdrivermanager.epub[EPUB]) is released under the terms of https://creativecommons.org/licenses/by-nc-sa/2.0/[CC BY-NC-SA 2.0].
780+
WebDriverManager (Copyright © 2015-2022) is an open-source project created and maintained by https://bonigarcia.dev/[Boni García] (https://twitter.com/boni_gg[@boni_gg]), licensed under the terms of https://www.apache.org/licenses/LICENSE-2.0[Apache 2.0 License]. This documentation (also available in link:webdrivermanager.pdf[PDF]) is released under the terms of https://creativecommons.org/licenses/by-nc-sa/2.0/[CC BY-NC-SA 2.0].

src/main/java/io/github/bonigarcia/wdm/WebDriverManager.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2015,8 +2015,8 @@ protected static void runInDocker(String[] args, String validBrowsers) {
20152015
wdm.quit();
20162016

20172017
} catch (Exception e) {
2018-
log.error("Browser {} not available in Docker (valid browsers {}): {}",
2019-
browserName, validBrowsers, e.getMessage());
2018+
log.error("Exception running {} in Docker (valid browsers {})",
2019+
browserName, validBrowsers, e);
20202020
}
20212021
}
20222022

src/main/java/io/github/bonigarcia/wdm/config/Config.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,9 @@ public class Config {
177177
ConfigKey<Boolean> useChromiumDriverSnap = new ConfigKey<>(
178178
"wdm.useChromiumDriverSnap", Boolean.class);
179179

180+
ConfigKey<String> safariVersion = new ConfigKey<>("wdm.safariVersion",
181+
String.class);
182+
180183
ConfigKey<Integer> ttl = new ConfigKey<>("wdm.ttl", Integer.class);
181184
ConfigKey<Integer> ttlForBrowsers = new ConfigKey<>("wdm.ttlForBrowsers",
182185
Integer.class);
@@ -1003,6 +1006,15 @@ public Config setChromiumDriverVersion(String value) {
10031006
return this;
10041007
}
10051008

1009+
public String getSafariVersion() {
1010+
return resolve(safariVersion);
1011+
}
1012+
1013+
public Config setSafariVersion(String value) {
1014+
this.safariVersion.setValue(value);
1015+
return this;
1016+
}
1017+
10061018
public String getChromiumVersion() {
10071019
return resolve(chromiumVersion);
10081020
}

src/main/java/io/github/bonigarcia/wdm/docker/DockerService.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -306,9 +306,8 @@ public String getBindPort(String containerId, String exposed)
306306
+ " getting bind port in container " + dockerImage);
307307
} else {
308308
try {
309-
log.trace("Port " + exposed
310-
+ " is not bindable in container "
311-
+ dockerImage);
309+
log.trace("Port {} is not bindable in container {}",
310+
exposed, dockerImage);
312311
Thread.sleep(POLL_TIME_MSEC);
313312
} catch (InterruptedException e) {
314313
log.warn("Interrupted exception getting bind port", e);
@@ -697,8 +696,7 @@ public DockerContainer startBrowserContainer(String dockerImage,
697696
browserContainer.setVncPort(vncPort);
698697
String vncAddress = format("vnc://%s:%s/", getDefaultHost(),
699698
vncPort);
700-
log.debug("VNC server URL: {} (password: {})", vncAddress,
701-
config.getDockerVncPassword());
699+
log.debug("VNC server URL: {}", vncAddress);
702700
browserContainer.setVncAddress(vncAddress);
703701
}
704702

src/main/java/io/github/bonigarcia/wdm/managers/SafariDriverManager.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,14 @@ protected Capabilities getCapabilities() {
5757
return new SafariOptions();
5858
}
5959

60+
@Override
61+
protected String getBrowserVersion() {
62+
return config().getSafariVersion();
63+
}
64+
65+
@Override
66+
protected void setBrowserVersion(String browserVersion) {
67+
config().setSafariVersion(browserVersion);
68+
}
69+
6070
}

0 commit comments

Comments
 (0)