Closed kazurayam closed 10 months ago
I tried to get
It responded the following JSON:
[
{
"tag_name": "v0.33.0",
"assets": [
{
"browser_download_url": "https://github.com/mozilla/geckodriver/releases/download/v0.33.0/geckodriver-v0.33.0-linux-aarch64.tar.gz"
},
{
"browser_download_url": "https://github.com/mozilla/geckodriver/releases/download/v0.33.0/geckodriver-v0.33.0-linux32.tar.gz"
},
{
"browser_download_url": "https://github.com/mozilla/geckodriver/releases/download/v0.33.0/geckodriver-v0.33.0-linux32.tar.gz.asc"
},
{
"browser_download_url": "https://github.com/mozilla/geckodriver/releases/download/v0.33.0/geckodriver-v0.33.0-linux64.tar.gz"
},
{
"browser_download_url": "https://github.com/mozilla/geckodriver/releases/download/v0.33.0/geckodriver-v0.33.0-linux64.tar.gz.asc"
},
{
"browser_download_url": "https://github.com/mozilla/geckodriver/releases/download/v0.33.0/geckodriver-v0.33.0-macos-aarch64.tar.gz"
},
{
"browser_download_url": "https://github.com/mozilla/geckodriver/releases/download/v0.33.0/geckodriver-v0.33.0-macos.tar.gz"
},
{
"browser_download_url": "https://github.com/mozilla/geckodriver/releases/download/v0.33.0/geckodriver-v0.33.0-win-aarch64.zip"
},
{
"browser_download_url": "https://github.com/mozilla/geckodriver/releases/download/v0.33.0/geckodriver-v0.33.0-win32.zip"
},
{
"browser_download_url": "https://github.com/mozilla/geckodriver/releases/download/v0.33.0/geckodriver-v0.33.0-win64.zip"
}
]
},
{
"tag_name": "v0.32.2",
"assets": [
{
"browser_download_url": "https://github.com/mozilla/geckodriver/releases/download/v0.32.2/geckodriver-v0.32.2-linux-aarch64.tar.gz"
},
{
"browser_download_url": "https://github.com/mozilla/geckodriver/releases/download/v0.32.2/geckodriver-v0.32.2-linux-aarch64.tar.gz.asc"
},
{
"browser_download_url": "https://github.com/mozilla/geckodriver/releases/download/v0.32.2/geckodriver-v0.32.2-linux32.tar.gz"
},
{
"browser_download_url": "https://github.com/mozilla/geckodriver/releases/download/v0.32.2/geckodriver-v0.32.2-linux32.tar.gz.asc"
},
{
"browser_download_url": "https://github.com/mozilla/geckodriver/releases/download/v0.32.2/geckodriver-v0.32.2-linux64.tar.gz"
},
{
"browser_download_url": "https://github.com/mozilla/geckodriver/releases/download/v0.32.2/geckodriver-v0.32.2-linux64.tar.gz.asc"
},
{
"browser_download_url": "https://github.com/mozilla/geckodriver/releases/download/v0.32.2/geckodriver-v0.32.2-macos-aarch64.tar.gz"
},
{
"browser_download_url": "https://github.com/mozilla/geckodriver/releases/download/v0.32.2/geckodriver-v0.32.2-macos.tar.gz"
},
{
"browser_download_url": "https://github.com/mozilla/geckodriver/releases/download/v0.32.2/geckodriver-v0.32.2-win-aarch64.zip"
},
{
"browser_download_url": "https://github.com/mozilla/geckodriver/releases/download/v0.32.2/geckodriver-v0.32.2-win32.zip"
},
{
"browser_download_url": "https://github.com/mozilla/geckodriver/releases/download/v0.32.2/geckodriver-v0.32.2-win64.zip"
}
]
},
....
I tried Selenium-java v4.14.1 instead of v4.13.0.
ext {
slf4jVersion = "2.0.9"
logbackVersion = "1.4.11"
seleniumVersion = "4.14.1"
//seleniumVersion = "4.13.0"
and tried
:~/github/selenium-webdriver-java
$ ./gradlew -q :selenium-webdriver-junit4:test --tests="*HelloWorldFirefixJUnit4Test*"
then I got the error same as #10
java.lang.NoClassDefFoundError: org/openqa/selenium/remote/http/netty/NettyClient$Factory
at java.base/java.lang.ClassLoader.defineClass1(Native Method)
at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1017)
...
I got no progress.
A similar issue was posted in the WebDriverManager project:
https://github.com/bonigarcia/webdrivermanager/issues/891
I tried configuring Logback to show the TRACE level messages. I created a file selenium-webdriver-java/selenium-webdriver-junit4/src/test/resources/logback-test.xml
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<logger name="io.github.bonigarcia" level="TRACE" />
</configuration>
But I could not see anything informative.
I read the instruction by @bonigarcia in the https://github.com/bonigarcia/webdrivermanager/issues/891
so I modified the HelloWorldFirefoxJUnit4Test.java slightly
@BeforeClass
public static void setupClass() {
//WebDriverManager.firefoxdriver().setup();
WebDriverManager.firefoxdriver().useMirror().setup();
}
Then the test ran successfully without "Error HTTP 404 executing https://raw.githubusercontent.com/bonigarcia/webdrivermanager/master/docs/mirror/geckodriver".
I do not yet see what's going on with the useMirror()
part.
By the way, the URL string contains a substring /mirror/. It smells to me.
What does the userMirror()
method does?
public WebDriverManager useMirror() {
Optional<URL> mirrorUrl = getMirrorUrl();
if (!mirrorUrl.isPresent()) {
throw new WebDriverManagerException("Mirror URL not available");
}
config().setUseMirror(true);
return this;
}
I found the string "https://raw.githubusercontent.com/bonigarcia/webdrivermanager/master/docs/mirror/geckodriver" in the source code repository at
Line#33
I experienced this "Error HTTP 404" on my MacBook Air with Chip Apple M1 , mac OS 12.7 + Firefox v119.0
I have one more MacBook Air (Retina, 130inch, 2018) with Chip X86-64, mac OS 12.6.8 + v118.0.2. I tried to execute the same Test : https://github.com/kazurayam/selenium-webdriver-java/blob/kazurayam14/selenium-webdriver-junit4/src/test/java/io/github/bonigarcia/webdriver/junit4/ch02/helloworld/HelloWorldFirefoxJUnit4Test.java
It silently passed without "Error HTTP 404" error on another MacBook Air X86-64 + Firefox v118.0.2!
On my MacBook Air with Apple M1 chip, macOS 12.6.8 I updated Firefox from v118.0.2 to v119.0, then tried the same test : https://github.com/kazurayam/selenium-webdriver-java/blob/kazurayam14/selenium-webdriver-junit4/src/test/java/io/github/bonigarcia/webdriver/junit4/ch02/helloworld/HelloWorldFirefoxJUnit4Test.java
The result: worked OK
> Task :selenium-webdriver-junit4:test
2023-10-30 10:26:49 [Test worker] DEBUG i.g.bonigarcia.wdm.WebDriverManager.<init>(225) - Using WebDriverManager 5.5.3
2023-10-30 10:26:50 [Test worker] DEBUG i.g.b.wdm.cache.ResolutionCache.checkKeyInResolutionCache(186) - Resolution firefox=118 in cache (valid until 10:59:08 30/10/2023 JST)
2023-10-30 10:26:50 [Test worker] DEBUG i.g.b.wdm.cache.ResolutionCache.checkKeyInResolutionCache(186) - Resolution firefox118=0.33.0 in cache (valid until 09:59:08 31/10/2023 JST)
2023-10-30 10:26:50 [Test worker] INFO i.g.bonigarcia.wdm.WebDriverManager.resolveDriverVersion(1217) - Using geckodriver 0.33.0 (resolved driver for Firefox 118)
2023-10-30 10:26:50 [Test worker] DEBUG i.g.bonigarcia.wdm.WebDriverManager.manage(1172) - Driver geckodriver 0.33.0 found in cache
2023-10-30 10:26:50 [Test worker] INFO i.g.bonigarcia.wdm.WebDriverManager.exportDriver(1270) - Exporting webdriver.gecko.driver as /Users/kazuakiurayama/.cache/selenium/geckodriver/mac64/0.33.0/geckodriver
2023-10-30 10:27:00 [Test worker] DEBUG i.g.b.w.j.c.h.HelloWorldFirefoxJUnit4Test.test(60) - The title of https://bonigarcia.dev/selenium-webdriver-java/ is Hands-On Selenium WebDriver with Java
io.github.bonigarcia.webdriver.junit4.ch02.helloworld.HelloWorldFirefoxJUnit4Test > test PASSED
Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
For more on this, please refer to https://docs.gradle.org/8.4/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.
BUILD SUCCESSFUL in 1m 51s
5 actionable tasks: 5 executed
10:27:03: Execution finished ':selenium-webdriver-junit4:test --tests "io.github.bonigarcia.webdriver.junit4.ch02.helloworld.HelloWorldFirefoxJUnit4Test"'.
This experiment implies 2 factors might be significant as a possible cause of the "Error HTTP 404" error:
Then I should update macOS 12.6.8 to 12.7 on my mac x86-64 machine, and see. .... Well, Apple suggests to upgrade macOS to v14.1 Sonora. Too distant! I wouldn't do it for now.
I tried the same test o my Windows PC.
The result: worked OK
> Task :selenium-webdriver-junit4:compileJava
> Task :selenium-webdriver-junit4:processResources
> Task :selenium-webdriver-junit4:classes
> Task :selenium-webdriver-junit4:compileTestJava
> Task :selenium-webdriver-junit4:processTestResources
> Task :selenium-webdriver-junit4:testClasses
Download https://repo.maven.apache.org/maven2/org/aspectj/aspectjweaver/1.9.9.1/aspectjweaver-1.9.9.1.pom, took 211 ms (2.07 kB)
Download https://repo.maven.apache.org/maven2/org/aspectj/aspectjweaver/1.9.9.1/aspectjweaver-1.9.9.1.jar, took 1 s 773 ms (2.09 MB)
2023-10-30 18:52:02 [Test worker] DEBUG i.g.bonigarcia.wdm.WebDriverManager.<init>(225) - Using WebDriverManager 5.5.3
2023-10-30 18:52:03 [Test worker] DEBUG i.g.b.wdm.versions.VersionDetector.getBrowserVersionFromTheShell(259) - Detecting firefox version using online commands.properties
2023-10-30 18:52:03 [Test worker] DEBUG i.g.bonigarcia.wdm.versions.Shell.runAndWaitArray(65) - Running command on the shell: [cmd.exe, /C, wmic, datafile, where, name="%PROGRAMFILES:\=\\%\\Mozilla, Firefox\\firefox.exe", get, Version, /value]
2023-10-30 18:52:04 [Test worker] DEBUG i.g.bonigarcia.wdm.versions.Shell.runAndWaitArray(69) - Result: Version=111.0.0.8468
2023-10-30 18:52:04 [Test worker] DEBUG i.g.b.wdm.versions.VersionDetector.getDriverVersionFromProperties(101) - Getting driver version for firefox111 from online versions.properties
2023-10-30 18:52:04 [Test worker] INFO i.g.bonigarcia.wdm.WebDriverManager.resolveDriverVersion(1217) - Using geckodriver 0.33.0 (resolved driver for Firefox 111)
2023-10-30 18:52:04 [Test worker] DEBUG i.g.b.wdm.cache.ResolutionCache.putValueInResolutionCacheIfEmpty(119) - Storing resolution firefox=111 in cache (valid until 19:52:04 30/10/2023 JST)
2023-10-30 18:52:04 [Test worker] DEBUG i.g.b.wdm.cache.ResolutionCache.putValueInResolutionCacheIfEmpty(119) - Storing resolution firefox111=0.33.0 in cache (valid until 18:52:04 31/10/2023 JST)
2023-10-30 18:52:04 [Test worker] INFO i.g.bonigarcia.wdm.WebDriverManager.logSeekRepo(1568) - Reading https://raw.githubusercontent.com/bonigarcia/webdrivermanager/master/docs/mirror/geckodriver to seek geckodriver
2023-10-30 18:52:04 [Test worker] DEBUG i.g.bonigarcia.wdm.WebDriverManager.createUrlHandler(1453) - Driver to be downloaded geckodriver 0.33.0
2023-10-30 18:52:04 [Test worker] INFO i.g.bonigarcia.wdm.online.Downloader.downloadAndExtract(132) - Downloading https://github.com/mozilla/geckodriver/releases/download/v0.33.0/geckodriver-v0.33.0-win64.zip
2023-10-30 18:52:06 [Test worker] INFO i.g.bonigarcia.wdm.online.Downloader.extract(193) - Extracting driver from compressed file geckodriver-v0.33.0-win64.zip
2023-10-30 18:52:07 [Test worker] INFO i.g.bonigarcia.wdm.WebDriverManager.exportDriver(1270) - Exporting webdriver.gecko.driver as C:\Users\uraya\.cache\selenium\geckodriver\win64\0.33.0\geckodriver.exe
2023-10-30 18:52:16 [Test worker] DEBUG i.g.b.w.j.c.h.HelloWorldFirefoxJUnit4Test.test(60) - The title of https://bonigarcia.dev/selenium-webdriver-java/ is Hands-On Selenium WebDriver with Java
> Task :selenium-webdriver-junit4:test
io.github.bonigarcia.webdriver.junit4.ch02.helloworld.HelloWorldFirefoxJUnit4Test > test PASSED
Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
For more on this, please refer to https://docs.gradle.org/8.4/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.
BUILD SUCCESSFUL in 1m 13s
5 actionable tasks: 5 executed
18:52:18: Execution finished ':selenium-webdriver-junit4:test --tests "io.github.bonigarcia.webdriver.junit4.ch02.helloworld.HelloWorldFirefoxJUnit4Test"'.
Now I can restate my problem. On my MacBook Air with Apple M1 Chip + macOS 12.7 +JDK17 +Gradle8.4 +FF v119, when I ran ch02/helloworld/HelloWorldFirefoxJUnit4Test, I got the error "Error HTTP 404 executing https://raw.githubusercontent.com/bonigarcia/webdrivermanager/master/docs/mirror/geckodriver". However, on another MacBook Air with x86-64 Chip, the test passed without any Error. Neither on Windows.
So, it seems that the error only occurs on a machine with Apple Silicon Chip. Is it really the case?
One more issue: I could confirm that the following change was effective:
//WebDriverManager.firefoxdriver().setup();
WebDriverManager.firefoxdriver().useMirror().setup();
Why is the useMirror()
effective? I guess that all useMirror()
does is to try another URL. See https://github.com/bonigarcia/webdrivermanager/blob/master/src/main/resources/webdrivermanager.properties
wdm.geckoDriverUrl=https://raw.githubusercontent.com/bonigarcia/webdrivermanager/master/docs/mirror/geckodriver
wdm.geckoDriverMirrorUrl=https://registry.npmmirror.com/-/binary/geckodriver/
How are these 2 URL different? I'm not yet convinced that the useMirror()
is an effective solution.
I am surprised.
I forked the webdrivermanager repository to my personal GitHub account. I cloned the master branch to my 2 MacBook Air. On both of them, I executed
$ mvn test
Then I saw the "Error HTTP 404 executing https://raw.githubusercontent.com/bonigarcia/webdrivermanager/master/docs/mirror/geckodriver" message repeatedly on both of MacBook Air x86-64 and M1 Chip.
I tried the same on my Windows 10 PC with JDK17. I did $ mvn test
on it ------ I saw NO "Error HTTP 404" for geckodriver!
So, I think that the webdrivermanager library does not work well on Mac, it works OK on Windows.
See https://github.com/bonigarcia/webdrivermanager/issues/1154
WebDriverManager has a know limitation accessing GitHub.
In order to avoid this error, possibly I should make a GitHub Personal Access Token and let WebDriverManager to use it.
I have created a GitHub Fine-gradle Personal Access Token as described in
https://qiita.com/ryamate/items/53b392b9bc6540f7f4c7
I named it as "For WebDriverManager since 31 Oct 2023".
I edited my ~/.bash_profile file:
# GITHUB
export GITHUB_TOKEN=github_pat_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
I stopped and restarted my Mac.
I confirmed that the environment variable GITHUB_TOKEN
is defined:
echo $GITHUB_TOKEN
github_pat_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Then I executed the test https://github.com/kazurayam/selenium-webdriver-java/blob/master/selenium-webdriver-junit4/src/test/java/io/github/bonigarcia/webdriver/junit4/ch05/cdp/FullPageScreenshotFirefoxJUnit4Test.java
Finally, the test passed successful.
Previously on my MacBook, I already had the envVar GITHUB_TOKEN
. But the specified value was invalid. Perhaps I removed the Personal Access Token out of my GitHub account, or the PAT has expired.
When the envVar GITHUB_TOKEN
is there with invalid value, WebDriverManager throws Error HTTP 404
This question was answered in
In the kazurayam8d branch, I executed
Then I got the following error: