How to handle this exception? Error communicating with the remote browser. It may have died

I was trying to launch the app and click on an element, and I see the below error.

org.openqa.selenium.remote.UnreachableBrowserException: Error communicating with the remote browser. It may have died.
Build info: version: ‘unknown’, revision: ‘c7b525d’, time: ‘2016-09-01 14:52:30 -0700’
System info: host: ‘Raja’, ip: ‘192.168.89.1’, os.name: ‘Windows 10’, os.arch: ‘amd64’, os.version: ‘10.0’, java.version: ‘1.8.0_91’
Driver info: driver.version: RemoteWebDriver
Capabilities [{app=C:\Users\Rajesh\workspace\Android_Test\Src\BookMyShow.apk, networkConnectionEnabled=true, warnings={}, databaseEnabled=false, deviceName=emulator-5554, platform=LINUX, desired={app=C:\Users\Rajesh\workspace\Android_Test\Src\BookMyShow.apk, newCommandTimeout=100, platformName=Android, deviceName=Android Emulator}, newCommandTimeout=100, platformVersion=6.0, webStorageEnabled=false, locationContextEnabled=false, browserName=Android, takesScreenshot=true, javascriptEnabled=true, platformName=Android}]
Session ID: bbf72b8d-d2af-491b-8cf5-bac5ed733033
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:618)
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:180)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:369)
at org.openqa.selenium.remote.RemoteWebDriver.findElementById(RemoteWebDriver.java:418)
at BookMy.test(BookMy.java:28)
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.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.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: org.openqa.selenium.WebDriverException: No command or response codec has been defined. Unable to proceed
Build info: version: ‘unknown’, revision: ‘c7b525d’, time: ‘2016-09-01 14:52:30 -0700’
System info: host: ‘Raja’, ip: ‘192.168.89.1’, os.name: ‘Windows 10’, os.arch: ‘amd64’, os.version: ‘10.0’, java.version: ‘1.8.0_91’
Driver info: driver.version: RemoteWebDriver
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:153)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:597)
… 27 more

Below are the details of the applications used and their versions along with code.

Appium: 1.4.16.1

Android Studio: 2.1

Android Version: 6.0(Marshmallow) - API 23(Rev 1)

Emulator Version: 25.1.17

Windows Version: 10 Home

Eclipse Version: Mars.2 Release (4.5.2)

Selenium Jar: JAVA 3.0.0-beta3 (PS: There is only 1 jar file downloaded from selenium website “client-combined-3.0.0-beta3-nodeps.jar”).

Below is the source code.

import static org.junit.Assert.*;
import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import org.junit.Test;
import org.openqa.selenium.remote.DesiredCapabilities;
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.remote.MobileCapabilityType;
import io.appium.java_client.remote.MobilePlatform;
 
public class BookMy {
 @Test public void test() throws MalformedURLException { 
 
File dir=new File("Src");
 File app=new File(dir, "BookMyShow.apk");  
 
DesiredCapabilities cap=new DesiredCapabilities(); 
cap.setCapability(MobileCapabilityType.PLATFORM_NAME, MobilePlatform.ANDROID); 
cap.setCapability(MobileCapabilityType.DEVICE_NAME, "Android Emulator"); 
cap.setCapability(MobileCapabilityType.NEW_COMMAND_TIMEOUT, "100"); 
cap.setCapability(MobileCapabilityType.APP, app.getAbsolutePath()); 
AndroidDriver driver=new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), cap); 
driver.findElementByName("Login").click();  
}
}

facing the same issue

1 Like

please help to resolve the same issue

1 Like

Appium version 1.5.1, Android emulator Nexus 5.1, facing the same issue : -

[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Using: UiSelector[INSTANCE=0, RESOURCE_ID=com.net.shine:id/progress_text]
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {“status”:0,“value”:{“ELEMENT”:“59”}}
[debug] [AndroidBootstrap] Received command result from bootstrap
[MJSONWP] Responding to client with driver.findElement() result: {“ELEMENT”:“59”}
[HTTP] <-- POST /wd/hub/session/b3371f08-6806-43b6-be4f-b3376a0eaefb/element 200 10 ms - 88
[HTTP] --> GET /wd/hub/session/b3371f08-6806-43b6-be4f-b3376a0eaefb/element/59/text {}
[MJSONWP] Calling AppiumDriver.getText() with args: [“59”,“b3371f08-6806-43b6-be4f-b3376a0eaefb”]
[debug] [AndroidBootstrap] Sending command to android: {“cmd”:“action”,“action”:“element:getText”,“params”:{“elementId”:“59”}}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {“cmd”:“action”,“action”:“element:getText”,“params”:{“elementId”:“59”}}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type ACTION
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command action: getText
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {“status”:0,“value”:“Loading…”}
[debug] [AndroidBootstrap] Received command result from bootstrap
[MJSONWP] Responding to client with driver.getText() result: “Loading…”
[HTTP] <-- GET /wd/hub/session/b3371f08-6806-43b6-be4f-b3376a0eaefb/element/59/text 200 10 ms - 84
^C

Please try with latest latest appium driver
https://search.maven.org/#search|ga|1|g%3A"io.appium"

it worked for me

please uses the latest appium jar file in eclipse

@Rajesh_Ravuri:- Have u add java-client-3.2.0.jar library?
https://search.maven.org/#search|ga|1|g%3Aio.appium%20a%3Ajava-client