Closed kazurayam closed 9 months ago
The following message tells me that I miss a jar for "Selenium DevTools v114"
> Task :selenium-webdriver-junit4:compileTestJava
/Users/kazuakiurayama/github/selenium-webdriver-java/selenium-webdriver-junit4/src/test/java/io/github/bonigarcia/webdriver/junit4/ch05/cdp/DeviceEmulationJUnit4Test.java:34: error: package org.openqa.selenium.devtools.v114.network does not exist
import org.openqa.selenium.devtools.v114.network.Network;
^
I found the jar is avaliable at
I should add declaring dependency to the jar.
for the Maven pom.xml files
<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-devtools-v114 -->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-devtools-v114</artifactId>
<version>4.12.1</version>
</dependency>
for the Gradle build.gradle files:
// https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-devtools-v114
testImplementation 'org.seleniumhq.selenium:selenium-devtools-v114:4.12.1'
I modified 4 build.gradle files in the project, and tried compiling the source with Gradle
:~/github/selenium-webdriver-java (kazurayam4)
$ ./gradlew build
> Task :selenium-webdriver-junit4:compileTestJava
/Users/kazuakiurayama/github/selenium-webdriver-java/selenium-webdriver-junit4/src/test/java/io/github/bonigarcia/webdriver/junit4/ch10/mobile/AppiumJUnit4Test.java:33: error: cannot find symbol
import io.appium.java_client.remote.MobileCapabilityType;
^
symbol: class MobileCapabilityType
location: package io.appium.java_client.remote
/Users/kazuakiurayama/github/selenium-webdriver-java/selenium-webdriver-junit4/src/test/java/io/github/bonigarcia/webdriver/junit4/ch10/mobile/AppiumJUnit4Test.java:45: error: cannot find symbol
options.setCapability(MobileCapabilityType.PLATFORM_NAME, "Android");
^
symbol: variable MobileCapabilityType
location: class AppiumJUnit4Test
/Users/kazuakiurayama/github/selenium-webdriver-java/selenium-webdriver-junit4/src/test/java/io/github/bonigarcia/webdriver/junit4/ch10/mobile/AppiumJUnit4Test.java:46: error: cannot find symbol
options.setCapability(MobileCapabilityType.DEVICE_NAME,
^
symbol: variable MobileCapabilityType
location: class AppiumJUnit4Test
/Users/kazuakiurayama/github/selenium-webdriver-java/selenium-webdriver-junit4/src/test/java/io/github/bonigarcia/webdriver/junit4/ch10/mobile/AppiumJUnit4Test.java:48: error: cannot find symbol
options.setCapability(MobileCapabilityType.AUTOMATION_NAME,
^
symbol: variable MobileCapabilityType
location: class AppiumJUnit4Test
4 errors
> Task :selenium-webdriver-junit4:compileTestJava FAILED
The errors about the DevTools v114 have gone.
The other errors such as "io.appium.java_client.remote.MobileCapabilityType" are another issue => issue #5
I also change the Maven pom.xml files.
And I tested compiling the sources with the Maven build tool:
:~/github/selenium-webdriver-java (kazurayam4 *)
$ mvn test
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] selenium-webdriver-junit4 [jar]
[INFO] selenium-webdriver-junit5 [jar]
[INFO] selenium-webdriver-junit5-seljup [jar]
[INFO] selenium-webdriver-testng [jar]
[INFO] selenium-webdriver-java [pom]
[INFO]
[INFO] -----------< io.github.bonigarcia:selenium-webdriver-junit4 >-----------
[INFO] Building selenium-webdriver-junit4 1.2.0 [1/5]
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ selenium-webdriver-junit4 ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 3 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ selenium-webdriver-junit4 ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ selenium-webdriver-junit4 ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 13 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ selenium-webdriver-junit4 ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 217 source files to /Users/kazuakiurayama/github/selenium-webdriver-java/selenium-webdriver-junit4/target/test-classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /Users/kazuakiurayama/github/selenium-webdriver-java/selenium-webdriver-junit4/src/test/java/io/github/bonigarcia/webdriver/junit4/ch10/mobile/AppiumJUnit4Test.java:[33,36] cannot find symbol
symbol: class MobileCapabilityType
location: package io.appium.java_client.remote
[ERROR] /Users/kazuakiurayama/github/selenium-webdriver-java/selenium-webdriver-junit4/src/test/java/io/github/bonigarcia/webdriver/junit4/ch10/mobile/AppiumJUnit4Test.java:[45,31] cannot find symbol
symbol: variable MobileCapabilityType
location: class io.github.bonigarcia.webdriver.junit4.ch10.mobile.AppiumJUnit4Test
[ERROR] /Users/kazuakiurayama/github/selenium-webdriver-java/selenium-webdriver-junit4/src/test/java/io/github/bonigarcia/webdriver/junit4/ch10/mobile/AppiumJUnit4Test.java:[46,31] cannot find symbol
symbol: variable MobileCapabilityType
location: class io.github.bonigarcia.webdriver.junit4.ch10.mobile.AppiumJUnit4Test
[ERROR] /Users/kazuakiurayama/github/selenium-webdriver-java/selenium-webdriver-junit4/src/test/java/io/github/bonigarcia/webdriver/junit4/ch10/mobile/AppiumJUnit4Test.java:[48,31] cannot find symbol
symbol: variable MobileCapabilityType
location: class io.github.bonigarcia.webdriver.junit4.ch10.mobile.AppiumJUnit4Test
[INFO] 4 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] selenium-webdriver-junit4 1.2.0 .................... FAILURE [ 8.420 s]
[INFO] selenium-webdriver-junit5 1.2.0 .................... SKIPPED
[INFO] selenium-webdriver-junit5-seljup 1.2.0 ............. SKIPPED
[INFO] selenium-webdriver-testng 1.2.0 .................... SKIPPED
[INFO] selenium-webdriver-java 1.0.0-SNAPSHOT ............. SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 8.574 s
[INFO] Finished at: 2023-10-20T20:38:11+09:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:testCompile (default-testCompile) on project selenium-webdriver-junit4: Compilation failure: Compilation failure:
[ERROR] /Users/kazuakiurayama/github/selenium-webdriver-java/selenium-webdriver-junit4/src/test/java/io/github/bonigarcia/webdriver/junit4/ch10/mobile/AppiumJUnit4Test.java:[33,36] cannot find symbol
[ERROR] symbol: class MobileCapabilityType
[ERROR] location: package io.appium.java_client.remote
[ERROR] /Users/kazuakiurayama/github/selenium-webdriver-java/selenium-webdriver-junit4/src/test/java/io/github/bonigarcia/webdriver/junit4/ch10/mobile/AppiumJUnit4Test.java:[45,31] cannot find symbol
[ERROR] symbol: variable MobileCapabilityType
[ERROR] location: class io.github.bonigarcia.webdriver.junit4.ch10.mobile.AppiumJUnit4Test
[ERROR] /Users/kazuakiurayama/github/selenium-webdriver-java/selenium-webdriver-junit4/src/test/java/io/github/bonigarcia/webdriver/junit4/ch10/mobile/AppiumJUnit4Test.java:[46,31] cannot find symbol
[ERROR] symbol: variable MobileCapabilityType
[ERROR] location: class io.github.bonigarcia.webdriver.junit4.ch10.mobile.AppiumJUnit4Test
[ERROR] /Users/kazuakiurayama/github/selenium-webdriver-java/selenium-webdriver-junit4/src/test/java/io/github/bonigarcia/webdriver/junit4/ch10/mobile/AppiumJUnit4Test.java:[48,31] cannot find symbol
[ERROR] symbol: variable MobileCapabilityType
[ERROR] location: class io.github.bonigarcia.webdriver.junit4.ch10.mobile.AppiumJUnit4Test
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
The Maven build tool run OK. No error about the DevTools v114. This issue#4 is resolved.
There found errors about Appium like [ERROR] symbol: class MobileCapabilityType
, I will follow them in another issue #5
It is difficult to manage the dependency to the jar of selenium-devtools-vXXX
.
As we all know, Chrome browser continues to evolve quite fast. As https://googlechromelabs.github.io/chrome-for-testing/ page shows, as of 21 Oct 2023, the current stable Chrome is v118, the beta v119 is already there, the canary v120 is in process.
The Selenium4 project will continue adding a new Maven repositories as Chrome upgrades in future:
Therefore, as Chrome evolves, the book "Selenium WebDriver in Java" have to be revised, the sample code project have to be updated. --- I am afraid, this makes the life of the book author(@bonigarcia) undurable.
In Jun 2023, Chrome for Testing was released.
If the book changes to use Chrome for Testing, rather than the greater Chrome for browsing, the difficulty of dependency management will dissappear.
Once I resolved the issue #3 (JDK17, Gradle 8.4), I got several compilation error message: