Unable to perform webview elements,pls help

android env:
driver.context(“WEBVIEW”);
System.out.println("-----------------------------");
WebElement email = driver.findElementById(“login_email”); <----appium throws error here

below is the error trace:
org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 1.03 seconds
Build info: version: ‘2.42.2’, revision: ‘6a6995d31c7c56c340d6f45a76976d43506cd6cc’, time: ‘2014-06-03 10:52:47’
System info: host: ‘PC-20140519QFMN’, ip: ‘172.20.1.58’, os.name: ‘Windows 7’, os.arch: ‘amd64’, os.version: ‘6.1’, java.version: ‘1.8.0_05’
Driver info: io.appium.java_client.AppiumDriver
Capabilities [{appPackage=com.gamelala.android.trivialdrivesample, networkConnectionEnabled=true, warnings={}, databaseEnabled=false, deviceName=Android Emulator, platform=LINUX, appActivity=.DemoActivity, desired={appPackage=com.gamelala.android.trivialdrivesample, appActivity=.DemoActivity, platformVersion=4.4.2, browserName=, platformName=Android, deviceName=Android Emulator}, platformVersion=4.4.2, webStorageEnabled=false, locationContextEnabled=false, browserName=, takesScreenshot=true, javascriptEnabled=true, platformName=Android}]
Session ID: a2c42115-319c-42bb-9bbb-e34b5e769f10
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:204)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:156)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:599)
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:95)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:352)
at org.openqa.selenium.remote.RemoteWebDriver.findElementById(RemoteWebDriver.java:393)
at Gamelala_01.GL_PAY.MainProcess.a_Paypal_Ts(MainProcess.java:88)
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:44)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

Please provide more details?

    DesiredCapabilities capabilities = new DesiredCapabilities();
    capabilities.setCapability(CapabilityType.BROWSER_NAME, "");
    capabilities.setCapability("deviceName", "Android Emulator");
    capabilities.setCapability("platformVersion", "4.4.2");
    capabilities.setCapability("platformName", "Android");
    //capabilities.setCapability("device", "Selendroid");
    capabilities.setCapability("appPackage",
            "com.abc.android.trivialdrivesample");
    capabilities.setCapability("appActivity", ".DemoActivity");

    AppiumDriver driver;
    driver = new AppiumDriver(new URL("http://127.0.0.1:4723/wd/hub"),
            capabilities);
    Thread.sleep(3000);

    String x = null;
    String rs = a01.get_paypalVal_from_RDSTR();
    a03.writeExcute(rs);
    CopyCFG.copyExecute();
    System.out.println(rs);
    rs = "F0";
    WebElement step1 = driver.findElement(By
            .id("com.abc.android.trivialdrivesample:id/bt_pay_3y"));
    step1.click();
    Thread.sleep(6000);
    Assert.assertNotNull(step1);
    WebElement step2 = driver.findElement(By
            .id("com.abc.android.trivialdrivesample:id/et_money"));
    step2.clear();
    step2.sendKeys(rs);
    WebElement step3 = driver.findElement(By
            .id("com.abc.android.trivialdrivesample:id/bt_buy"));
    step3.click();
    Thread.sleep(6000);
    WebElement step4 = driver
            .findElement(By
                    .id("com.abc.android.trivialdrivesample:id/rb_paypal_pay"));
    step4.click();
    WebElement step5 = driver.findElement(By
            .id("com.abc.android.trivialdrivesample:id/bt_save"));
    step5.click();
    Thread.sleep(50000);
    driver.context("WEBVIEW");
    System.out.println(driver.getContext());
    System.out.println("-----------------------------");
    WebElement email = driver.findElementById("login_email");

for Native view , it’s ok
but when it switch to webview by driver.context(“WEBVIEW”); appium throws the previous error
the error detail is :smile:
org.openqa.selenium.WebDriverException: An unknown server-side error
occurred while processing the command. (WARNING: The server did not
provide any stacktrace information)
Command duration or timeout: 1.03 seconds
Build info: version: ‘2.42.2’, revision: ‘6a6995d31c7c56c340d6f45a76976d43506cd6cc’, time: ‘2014-06-03 10:52:47’
System
info: host: ‘PC-20140519QFMN’, ip: ‘172.20.1.58’, os.name: ‘Windows 7’,
os.arch: ‘amd64’, os.version: ‘6.1’, java.version: ‘1.8.0_05’
Driver info: io.appium.java_client.AppiumDriver
Capabilities
[{appPackage=com.gamelala.android.trivialdrivesample,
networkConnectionEnabled=true, warnings={}, databaseEnabled=false,
deviceName=Android Emulator, platform=LINUX, appActivity=.DemoActivity,
desired={appPackage=com.gamelala.android.trivialdrivesample,
appActivity=.DemoActivity, platformVersion=4.4.2, browserName=,
platformName=Android, deviceName=Android Emulator},
platformVersion=4.4.2, webStorageEnabled=false,
locationContextEnabled=false, browserName=, takesScreenshot=true,
javascriptEnabled=true, platformName=Android}]
Session ID: a2c42115-319c-42bb-9bbb-e34b5e769f10
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:204)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:156)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:599)
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:95)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:352)
at org.openqa.selenium.remote.RemoteWebDriver.findElementById(RemoteWebDriver.java:393)
at Gamelala_01.GL_PAY.MainProcess.a_Paypal_Ts(MainProcess.java:88)
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:44)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

platform is 4.4.2
api level is 19
cpu/ABI : ARM(armeabi-v7a)
and i run my appium scripts in android-emulator

when it calls driver.findElementById(“login_email”), the error message is thrown.

First thing, if u r using API 4.4.2 then why do u run test with selendroid mode. So first change this to Appium mode. Kindly run ur scripts and let me know the results.

Thanks,
Priyank Shah

but the selendroid mode was annotated, //capabilities.setCapability(“device”, “Selendroid”);

i tried this test code:
Set contextNames = driver.getContextHandles();

    for (String contextName : contextNames) {

        System.out.println(contextName); 

    }

and it returns
WEBVIEW_com.test.android.trivialdrivesample

how to set the param of driver.context();
driver.context(“WEBVIEW”) ?

yes, so you changed selendroid capability?

i tried selendroid ,but also failed

i just want to locate an element on a webview,why it always says:
ebug: Responding to client with error: {“status”:13,“value”:{“message”:“An unknown server-side error occurred while processing the command.”,“origValue”:“unknown error: Function already created: concat.\n (Session info: chrome=webview)\n (Driver info: chromedriver=2.9.248315,platform=Windows NT 6.1 SP1 x86_64)”},“sessionId”:“88c5b62c-fa17-46c5-a0db-af156701d08f”}

debug: Didn’t get a new command in 60 secs, shutting down…

just set it as follow

driver.context(contextNames.toArray()[index of mentioned webView context].toString());