Shakir
Shakir

Reputation: 133

io.github.bonigarcia.wdm.WebDriverManagerException: A response error is detected: HTTP/1.1 403 Forbidden error using WebDriverManager and FireFox

I am running my Selenium automation code in Firefox and getting the below error : io.github.bonigarcia.wdm.WebDriverManagerException: A response error is detected: HTTP/1.1 403 Forbidden

It is working fine in Chrome browser.

FireFox version : 70.0.1 (64-bit)

OS : Mac OS

Upvotes: 1

Views: 12473

Answers (1)

undetected Selenium
undetected Selenium

Reputation: 193298

This error message...

io.github.bonigarcia.wdm.WebDriverManagerException: A response error is detected: HTTP/1.1 403 Forbidden

...was observed with someof the binaries (for Opera and Firefox) which are hosted on GitHub.


As per the discussion in WebDriverManagerException: A response error is detected: HTTP/1.1 403 Forbidden Boni García referred this issue as a known issue within webdrivermanager.

In the Known issues section it is documented that:

Some of the binaries (for Opera and Firefox) are hosted on GitHub. When several consecutive requests are made by WebDriverManager, GitHub servers return an HTTP 403 error response as follows:

Caused by: java.io.IOException: Server returned HTTP response code: 403 for URL: https://api.github.com/repos/operasoftware/operachromiumdriver/releases
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1840)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1441)
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:254)
    at io.github.bonigarcia.wdm.BrowserManager.openGitHubConnection(BrowserManager.java:463)
    at io.github.bonigarcia.wdm.OperaDriverManager.getDrivers(OperaDriverManager.java:55)
    at io.github.bonigarcia.wdm.BrowserManager.manage(BrowserManager.java:168)
      

and some time as:

Caused by: java.io.IOException: Server returned HTTP response code: 403 for URL: https://api.github.com/repos/mozilla/geckodriver/releases
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1840)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1441)
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:254)
    at io.github.bonigarcia.wdm.FirefoxDriverManager.getDrivers(FirefoxDriverManager.java:61)
    at io.github.bonigarcia.wdm.BrowserManager.manage(BrowserManager.java:163)

This problem can be addressed by sending authenticated requests. The procedure is the following:

  1. Create a token/secret pair in your GitHub account.

  2. Tell WebDriverManager the value of this pair token/secret. To do that you should use the configuration keys wdm.gitHubTokenName and wdm.gitHubTokenSecret. You can pass them as command line Java parameters as follows:

     -Dwdm.gitHubTokenName=<your-token-name>
     -Dwdm.gitHubTokenSecret=<your-token-secret>
    

... or as environment variables (e.g. in Travis CI) as follows:

    WDM_GITHUBTOKENNAME=<your-token-name>
    WDM_GITHUBTOKENSECRET=<your-token-secret>

Upvotes: 0

Related Questions