Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to run my tests because of connection timed out #299

Closed
RabiaShaik opened this issue Jan 16, 2019 · 4 comments
Closed

Unable to run my tests because of connection timed out #299

RabiaShaik opened this issue Jan 16, 2019 · 4 comments
Labels

Comments

@RabiaShaik
Copy link

RabiaShaik commented Jan 16, 2019

Hi,
I am unable to run the tests using bonigarcia dependancy as I hit the issue that is mentioned below.

io.github.bonigarcia.wdm.WebDriverManagerException: org.apache.http.conn.HttpHostConnectException: Connect to chromedriver.storage.googleapis.com:443 [chromedriver.storage.googleapis.com/172.217.17.80, chromedriver.storage.googleapis.com/2a00:1450:400e:805:0:0:0:2010] failed: Connection timed out: connect

at io.github.bonigarcia.wdm.WebDriverManager.handleException(WebDriverManager.java:684)
at io.github.bonigarcia.wdm.WebDriverManager.manage(WebDriverManager.java:521)
at io.github.bonigarcia.wdm.WebDriverManager.handleException(WebDriverManager.java:681)
at io.github.bonigarcia.wdm.WebDriverManager.manage(WebDriverManager.java:521)
at io.github.bonigarcia.wdm.WebDriverManager.setup(WebDriverManager.java:251)
at UiUtils.SeleniumWebDriver.getDriver(SeleniumWebDriver.java:20)
at UiUtils.SeleniumWebDriver.initializeDriver(SeleniumWebDriver.java:39)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)

Caused by: org.apache.http.conn.HttpHostConnectException: Connect to chromedriver.storage.googleapis.com:443 [chromedriver.storage.googleapis.com/172.217.17.80, chromedriver.storage.googleapis.com/2a00:1450:400e:805:0:0:0:2010] failed: Connection timed out: connect
at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:159)
at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:359)
at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:381)
at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:237)
at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:185)
at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89)
at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:111)
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:108)
at io.github.bonigarcia.wdm.HttpClient.execute(HttpClient.java:159)
at io.github.bonigarcia.wdm.WebDriverManager.getDriversFromXml(WebDriverManager.java:996)

This is my code

package UiUtils;


import io.github.bonigarcia.wdm.WebDriverManager;
import org.junit.Test;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;

public class SeleniumWebDriver {

    private WebDriver driver;

  public static WebDriver getDriver() {

    String browser = "CHROME";
    String url = "www.google.com";
    if (browser.toUpperCase().equals("CHROME")) {
      WebDriverManager.chromedriver().setup();
      return new ChromeDriver();
    }
    else {
      switch (browser) {
        case "IE":
          WebDriverManager.iedriver().setup();
          return new InternetExplorerDriver();
        case "FIREFOX":
          WebDriverManager.firefoxdriver().setup();
          return new FirefoxDriver();
        default:
          WebDriverManager.chromedriver().setup();
          return new ChromeDriver();
      }
    }
}
    @Test
    public void initializeDriver(){
        driver = getDriver();
        driver.get("url");
    }
    // Close the webDriver instance
    public void closeDriver(){
        driver.quit();
    }
}

I am using the dependancy

io.github.bonigarcia webdrivermanager 3.2.0 test
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <version>3.11.0</version>
    </dependency><dependency>
    <groupId>io.github.bonigarcia</groupId>
    <artifactId>webdrivermanager</artifactId>
    <version>RELEASE</version>
    <scope>compile</scope>
</dependency>

I tried adding the proxy and port in the IDE, not sure if am doing it correctly
I have set the no proxy for : *storage.googleapis.com:443
Also added the ip in /etc/hosts file but nothing works

Kindly help

@bonigarcia
Copy link
Owner

Are you behind a proxy? If so, you can to specify hour proxy setup as follows:

WebDriverManager.chromedriver().proxy("server:port").setup();

Do the same for iedriver() and firefoxdriver().

@RabiaShaik
Copy link
Author

RabiaShaik commented Jan 22, 2019

Hi thanks for the reply. After adding the proxy I am seeing the browser getting opened, however I hit another issue

java.lang.NoSuchMethodError: okio.BufferedSource.readUtf8LineStrict(J)Ljava/lang/String;

	at okhttp3.internal.http1.Http1Codec.readHeaderLine(Http1Codec.java:212)
	at okhttp3.internal.http1.Http1Codec.readResponseHeaders(Http1Codec.java:189)
	at okhttp3.internal.http.CallServerInterceptor.intercept(CallServerInterceptor.java:88)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
	at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:45)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
	at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
	at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
	at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:125)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
	at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:200)
	at okhttp3.RealCall.execute(RealCall.java:77)
	at org.openqa.selenium.remote.internal.OkHttpClient.execute(OkHttpClient.java:101)
	at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:101)
	at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:73)
	at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:136)
	at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
	at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:545)
	at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:209)
	at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:132)
	at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:120)
	at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:98)
	at UiUtils.SeleniumWebDriver.getDriver(SeleniumWebDriver.java:29)
	at UiUtils.SeleniumWebDriver.initializeDriver(SeleniumWebDriver.java:38)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
	at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)

Any idea how to fix this. I am looking in to online help

@bonigarcia
Copy link
Owner

That's an issue related with WebDriver, not WebDriverManager. It seems you have a conflict with the version of okhttp, I guess the transitive version used by WebDriver is in conflict with some other.

@vishwas20
Copy link

@bonigarcia Any suggestions to do the same in Python ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants