Skip to content
This repository has been archived by the owner on Nov 29, 2018. It is now read-only.

Error communicating with the remote browser. It may have died. #5832

Closed
lukeis opened this issue Mar 4, 2016 · 11 comments
Closed

Error communicating with the remote browser. It may have died. #5832

lukeis opened this issue Mar 4, 2016 · 11 comments

Comments

@lukeis
Copy link
Member

lukeis commented Mar 4, 2016

Originally reported on Google Code with ID 5832

OS: Windows 8
Selenium WebDriver: selenium-java-2.33.0
Android Driver/Server: android-server-2.32.0.apk
Android SDK: 4.2.2 (API 17)
JDK:build 1.7.0-b147
Eclipse: Version: 4.2.x (Android Developer Tools, Build: v21.1.0-569685) 

Trying to run tests on Android Emulator
Following all steps as given at https://code.google.com/p/selenium/wiki/AndroidDriver

Trying to run the google search test given there and getting the errors as below repeatedly
without a single successful 

run of the test.
Please help.
Found that issues 4319 marked duplicate and closed and 4150 as fixed long back, so
opened a new one.

FAILED: GoogleSearch_Test
org.openqa.selenium.remote.UnreachableBrowserException: Error communicating with the
remote browser. It may have died.
Build info: version: '2.33.0', revision: '4e90c97', time: '2013-05-22 15:33:32'
System info: os.name: 'Windows NT (unknown)', os.arch: 'x86', os.version: '6.2', java.version:
'1.7.0'
Driver info: driver.version: RemoteWebDriver
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:548)
    at org.openqa.selenium.remote.RemoteWebDriver.get(RemoteWebDriver.java:276)
    at atf.TC_1.GoogleSearch_Test(TC_1.java:15)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)
    at org.testng.internal.Invoker.invokeMethod(Invoker.java:714)
    at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
    at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
    at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
    at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
    at org.testng.TestRunner.privateRun(TestRunner.java:767)
    at org.testng.TestRunner.run(TestRunner.java:617)
    at org.testng.SuiteRunner.runTest(SuiteRunner.java:335)
    at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:330)
    at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
    at org.testng.SuiteRunner.run(SuiteRunner.java:240)
    at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
    at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
    at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)
    at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)
    at org.testng.TestNG.run(TestNG.java:1057)
    at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)
    at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)
    at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)
Caused by: org.apache.http.NoHttpResponseException: The target server failed to respond
    at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:95)
    at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:62)
    at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:254)
    at org.apache.http.impl.AbstractHttpClientConnection.receiveResponseHeader(AbstractHttpClientConnection.java:289)
    at org.apache.http.impl.conn.DefaultClientConnection.receiveResponseHeader(DefaultClientConnection.java:252)
    at org.apache.http.impl.conn.AbstractClientConnAdapter.receiveResponseHeader(AbstractClientConnAdapter.java:219)
    at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:300)
    at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:127)
    at org.apache.http.impl.client.DefaultRequestDirector.tryExecute(DefaultRequestDirector.java:712)
    at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:517)
    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:906)
    at org.openqa.selenium.remote.HttpCommandExecutor.fallBackExecute(HttpCommandExecutor.java:334)
    at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:295)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:527)
    ... 26 more

After the above exception the test run is over and then the Google page is shown in
the emulator.
So tried by introducing the 
driver.manage().timeouts().pageLoadTimeout(20, TimeUnit.SECONDS);
However, it looks like pageLoadTimeout has no effect, the exception occurs and test
ends with fail status

Also, tried the below multiple times with no luck

adb kill-server
adb start-server
adb devices
adb -s emulator-5554 -e install -r  android-server-2.32.0.apk - did this once with
success

adb -s emulator-5554 forward tcp:8080 tcp:8080
Also tried to check if there is something wrong with port forward by doing
adb -s emulator-5554 forward tcp:5037 tcp:5554
but this gives error "error: cannot rebind smartsocket" probably because I have only
one emulator instance running and adb 

by def is connecting to it..not sure about this complexity thought.

Almost tried all a newbie can and still stuck! 
Please help. Thanks in advance.

FYI test code

import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.android.AndroidDriver;
import org.testng.annotations.Test;

public class TC_1 {

    @Test
    public void GoogleSearch_Test(){

        WebDriver driver = new AndroidDriver();
        driver.get("http://www.google.co.in/");
        driver.manage().timeouts().pageLoadTimeout(20, TimeUnit.SECONDS);
        WebElement element = driver.findElement(By.name("q"));
        element.sendKeys("Cheese!");
        element.submit();
        System.out.println("Page title is: " + driver.getTitle());

        driver.quit();
    }
}


Side notes:
1) The whole of the ecosystem of Eclipse, Selenium WebDriver, AVD is running very slow
though I am using Dell intel 

i5 processor, 4 GB RAM and Gigs of HDD. (also tried using Snapshot feature in AVD!
did not see any differnce as such in the speed AVD id loaded/started) 
Does it need higher configuration than this or this should be sufficient?

2) As all this is a marriage of 'n' number of things, is there anything like 'recommended
versions that work well together', could not find any doc/note for this. If you can
point to a link would appreciate.
This involves
1. JDK
2. Eclipse
3. Selenium WebDriver Jars
4. TestNG
5. Android SDK
6. Android Driver apk

Please help, thanks!

Reported by vivektests on 2013-06-25 14:00:54

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

Hi
I have faced the same issue while running tests on Android emulator 4.2.2. Please help,
thanks!!!

Reported by priya.banumca on 2013-07-15 09:01:46

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

Hi, 
I am also facing same problem... while running tests on device as well as on emulator
pleae help, Thnx

Reported by smith.jhones3 on 2013-07-15 14:22:31

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

Hi friends,

I am also facing the same problem now. please help me on this if you know the solution.
thanks lot in advance

Reported by ranjithan04 on 2013-07-17 09:46:25

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

anyone found an solution ? Im trying example on device without success. always fail.
on 10 runs only once did it right.

Reported by Juandeldesierto on 2013-07-17 20:33:55

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

I think the reason is in slow internet connection. I tried it from another place where
connection is faster and it worked better. Also I attach screen shot what shows Resource
monitor and maximal utilizing network

Reported by dstarchevskyqa on 2013-07-18 08:12:49


- _Attachment: MaxConnections.png
![MaxConnections.png](https://storage.googleapis.com/google-code-attachments/selenium/issue-5832/comment-5/MaxConnections.png)_

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

Same issue, connected to a real device. Pretty much the same setup except the androiddriver
to a real (samsung, 4.x) device. The code has passed sometimes, but fail often enough
to be a real block for test automation.

Reported by jinn_amaranth@hotmail.com on 2013-07-26 22:15:09

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

I experience the same issue. It appears the android driver couldn't seem find the Google
search box. This is specific to Android only. In other browser the code works perfectly
ok. I also tried changing the "WebElement element = driver.findElement(By.name("q"));"
to "WebElement element = driver.findElement(By.id("gbqfq"));". In second case the code
breaks with exception that it could not find element by this id. I reckon the current
Android driver is buggy.

Reported by alnoor.khimani on 2013-07-31 13:58:27

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

I have some success with android-server-2.21.0.apk then android-server-2.32.0.apk

Reported by alnoor.khimani on 2013-07-31 14:07:21

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

Reported by barancev on 2013-08-08 23:09:03

  • Labels added: Browser-Android

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

Selenium project no longer supports the AndroidDriver.

Please use Selendroid instead:
http://selendroid.io/webview.html

And log any issues against that project:
https://github.com/selendroid/selendroid/issues

Reported by luke.semerau on 2013-12-26 21:57:36

  • Status changed: WontFix

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

Reported by luke.semerau on 2015-09-17 18:17:27

  • Labels added: Restrict-AddIssueComment-Commit

@lukeis lukeis closed this as completed Mar 4, 2016
@SeleniumHQ SeleniumHQ locked and limited conversation to collaborators Mar 4, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant