Appium can not switch to webview :WebDriverException: Not yet implemented.

5,662 views
Skip to first unread message

Shu Chen

unread,
Jun 7, 2013, 4:19:37 PM6/7/13
to appium-...@googlegroups.com
Hi,

Is there a code sample for how to switch to web view  in java code? I read in the document it is supported but in my code it get exception as " not implemented" :

capability setting like 
        capabilities.setCapability(CapabilityType.BROWSER_NAME, "android"); // also tried with "selendroid");

        capabilities.setCapability(CapabilityType.VERSION,"4.2");

        capabilities.setCapability(CapabilityType.PLATFORM, "MAC");

        capabilities.setCapability("device", "Android" );

        capabilities.setCapability("app",".... my apk path");

        capabilities.setCapability("app-package", "my package");

        capabilities.setCapability("app-activity", "my Activity");

        driver = new RemoteWebDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);


and here is the code piece  i tried to switch to web view :

        driver.switchTo().window((String)driver.getWindowHandles().toArray()[windowIndex]);


I get exception as:

org.openqa.selenium.WebDriverException: Not yet implemented. Please help us: http://appium.io/get-involved.html (WARNING: The server did not provide any stacktrace information)

Command duration or timeout: 8 milliseconds

Build info: version: '2.32.0', revision: '6c40c18', time: '2013-04-09 17:23:22'

System info: os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.8.4', java.version: '1.7.0_21'

Session ID: 58916397-0085-49f5-8ff9-440bdcc4cd69

Driver info: org.openqa.selenium.remote.RemoteWebDriver

Capabilities [{platform=LINUX, databaseEnabled=false, javascriptEnabled=true, browserName=Android, takesScreenshots=true, webStorageEnabled=false, version=4.1}]

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)

at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)

at java.lang.reflect.Constructor.newInstance(Constructor.java:525)

at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:187)

at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:145)

at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:554)

at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:569)

at org.openqa.selenium.remote.RemoteWebDriver.getWindowHandles(RemoteWebDriver.java:432)

Jonathan Lipps

unread,
Jun 7, 2013, 4:20:49 PM6/7/13
to Shu Chen, appium-...@googlegroups.com
switching to webview with selendroid is different:


--
http://appium.io
---
You received this message because you are subscribed to the Google Groups "Appium-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to appium-discus...@googlegroups.com.
Visit this group at http://groups.google.com/group/appium-discuss?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Shu Chen

unread,
Jun 7, 2013, 4:35:13 PM6/7/13
to appium-...@googlegroups.com, Shu Chen
Thanks for the quick reply 
I tried selendroid way and still get the same error 

        capabilities.setCapability(CapabilityType.BROWSER_NAME"selendroid");

     capabilities.setCapability(CapabilityType.VERSION,"4.2");

        capabilities.setCapability(CapabilityType.PLATFORM"MAC");

        capabilities.setCapability("device", "Android" );
code :
       driver.switchTo().window("WEBVIEW");   --- same exception

also, I switched back to appium as below but still get the same error :

        capabilities.setCapability(CapabilityType.BROWSER_NAME, "android");

    capabilities.setCapability(CapabilityType.VERSION,"4.2");

        capabilities.setCapability(CapabilityType.PLATFORM, "MAC");

        capabilities.setCapability("device", "Android" );


code:

         driver.switchTo().window((String)driver.getWindowHandles().toArray()[windowIndex]);  -- same exception at this line .

Shu Chen

unread,
Jun 7, 2013, 4:36:32 PM6/7/13
to appium-...@googlegroups.com, Shu Chen
btw, I start the appium by appium.app

Jonathan Lipps

unread,
Jun 7, 2013, 4:44:17 PM6/7/13
to Shu Chen, appium-...@googlegroups.com

        capabilities.setCapability(CapabilityType.BROWSER_NAME"selendroid");


don't use browsername in appium

        capabilities.setCapability("device""Android" );


device needs to be selendroid

Shu Chen

unread,
Jun 7, 2013, 5:44:28 PM6/7/13
to appium-...@googlegroups.com, Shu Chen
thanks for the reply, I tried for the new config and get new error "Permission Denial" :

org.openqa.selendroid.ServerInstrumentation} from pid=2178, uid=2178 not allowed because package com.amazon.mShop.android.selendroid does not have a signature matching the target 


investigating now 

Shu Chen

unread,
Jun 7, 2013, 5:59:46 PM6/7/13
to appium-...@googlegroups.com, Shu Chen
btw , do you have any idea why is my appium version get failed for "not implement" error as well?

gobi

unread,
May 19, 2014, 8:42:25 AM5/19/14
to appium-...@googlegroups.com, Shu Chen
Hi,

I am facing this issue with IOS while trying to switch into webview.
While trying withe below code i am getting "Not yet Implemented issue"
 driver.switchTo().window("webView");
Also i am unable to use  driver.switchTo().context("WEBVIEW");
I am using selenium-server-standalone-2.41.0.jar, selenium-java-2.41.0, it shows error in eclipse "The method context(String) is undefined for the type WebDriver.TargetLocator"
Anyone fixed this issue for switching webview mode and how to do it?

Isaac Murchie

unread,
May 19, 2014, 2:54:14 PM5/19/14
to gobi, appium-...@googlegroups.com
Can you give a little more information? Are you using Appium? What version of Appium are you using? 


gobi

unread,
May 19, 2014, 10:14:40 PM5/19/14
to appium-...@googlegroups.com, gobi
yes, using appium app version 1.0.0

Isaac Murchie

unread,
May 19, 2014, 10:29:02 PM5/19/14
to gobi, appium-...@googlegroups.com
What are you doing with the Selenium jar then? driver.switchTo().context("WEBVIEW");  should work for Appium 1.0. 

Isaac Murchie

unread,
May 20, 2014, 11:38:40 AM5/20/14
to Gobi Irtt, appium-...@googlegroups.com
As the sample code shows, it is not "switchTo" anymore. driver.context(contextName) is the syntax now. I'm not sure what the NullPointerException is caused by.

What is returned by getContextHandles?


On Tue, May 20, 2014 at 2:36 AM, Gobi Irtt <mgobi...@gmail.com> wrote:
I have tried with the following to switch WEBVIEW mode and failed:

************
Set<String> contextNames = driver.getContextHandles();
        System.out.println("@test");
        for (String contextName : contextNames) {
          System.out.println(contextName);
          if (contextName.contains("WEBVIEW")){
            driver.context(contextName);
          }
        }
Error: java.lang.NullPointerException     at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:78)
********
 driver.switchTo().window("WEBVIEW");
Error:
not yet implemented in this context try switching into or out of web view
**********

Could you please suggest me what to use on this for switching into webview mode so that i have to load the URL in this?
whether to use switchTo.window or context or driver.context().
driver.switchTo(). doenot give interlligence for context and using context in code it quit unexpectedly.



On Tue, May 20, 2014 at 10:13 AM, Isaac Murchie <is...@saucelabs.com> wrote:


On Mon, May 19, 2014 at 9:33 PM, Gobi Irtt <mgobi...@gmail.com> wrote:
Yes thanks! now came to know it is all possible to do with Appium!

For this i need to switch into webview mode and driver.get("url") will change the url of the webview.

Is there any sample java code exist for switchTo.context("webview") i am struck at this point. If this resolved i am able to run with all test cases/



On Tue, May 20, 2014 at 9:50 AM, Isaac Murchie <is...@saucelabs.com> wrote:
Yes, that is totally possible. See the docs for mobile web.



On Mon, May 19, 2014 at 9:17 PM, Gobi Irtt <mgobi...@gmail.com> wrote:
Ok Thanks! I will check.

I need to clarify the following. Is it possible to load dynamic URL in webview for hybrid applications?

Since i am able to get webview and its element and able to perform events on it, I need to load the URL into current webview. Is it possible to do?

Such that i dont want to cahgne the URL in app everytime and reload the app into appium for testing


On Tue, May 20, 2014 at 9:23 AM, Isaac Murchie <is...@saucelabs.com> wrote:
Just use the Appium program (either from npm or from source via GitHub. Selendroid is bundled with it.



On Mon, May 19, 2014 at 8:50 PM, Gobi Irtt <mgobi...@gmail.com> wrote:
For which jar i need to refer to work with this? I am writing common test case for Android(Selendroid) and iOS(Appium 1.0) so refered this files.

Could you please let me know what are the files needed to refer for context() to work with appium?
Message has been deleted

gobi

unread,
May 27, 2014, 7:41:28 AM5/27/14
to appium-...@googlegroups.com, Gobi Irtt
Finally, Its working in simulator and produce only with device! I suspect that this error may due to ios_webkit_debug_proxy ! Thanks for your assistance!
Message has been deleted

Vikas Chaudhary

unread,
Jun 11, 2014, 9:23:32 PM6/11/14
to appium-...@googlegroups.com, mgobi...@gmail.com
Ok here the issue is

In AppiumDriver, following line is written:
           Response response = execute(DriverCommand.GET_CONTEXT_HANDLES);
In DriveCcommand interface, this contant is not defined and hence null pointer.. At least in the version 2.42.0. Please check. I am not sure how to  fix this.
can anyone confirm in which selenium-java version this constant is defined.

Isaac Murchie

unread,
Jun 13, 2014, 6:57:25 PM6/13/14
to Vikas Chaudhary, appium-...@googlegroups.com, gobi irtt
You need Selenium 2.42.2. Your version was broken wrt contexts 

automated tester

unread,
Jun 19, 2014, 9:50:42 PM6/19/14
to appium-...@googlegroups.com
Im facing the same issue in C#.  I have .2.40 dll of selenium and running on Appium 1.0, I'm getting the error:

System.NotImplementedException : Not implemented in this context, try switching into or out of a web view



Here is a sample of the code, it just fails where i try and get window handles. This previously used to work

DesiredCapabilities capabilities = new DesiredCapabilities();
                capabilities.SetCapability("device", "iPhone Simulator");
                capabilities.SetCapability(CapabilityType.Version, "7");
                capabilities.SetCapability(CapabilityType.Platform, "MAC");
                capabilities.SetCapability("app", "http://xxx.xxx.xxx/MyApp.app.zip");

                using (ScreenShotRemoteWebDriver driver = new ScreenShotRemoteWebDriver(new Uri("http://xxx.xxx.xxx:4723/wd/hub"), capabilities))
{
                    var h = driver.WindowHandles;
                    driver.SwitchTo().Window("1");




Anyone have a resolution around this ?

Isaac Murchie

unread,
Jun 20, 2014, 12:40:18 PM6/20/14
to automated tester, appium-...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages