i am new to Appium, trying with Hybrid app which has been developed using Phonegap.
the problem which i am facing is couldn’t able to navigate to WebView. upto FrameLayout i can able to drive but after than i couldn’t. please guide me.
please find my following code used:-
Envrionment :
Appium Version : 1.3.4.1
Device Used: S5
Android Version : 4.4.2
java client : 2.1
File appDir = new File("Path");
File app = new File(appDir, ".apk");
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities = DesiredCapabilities.android();
capabilities.setCapability(CapabilityType.BROWSER_NAME, "");
capabilities.setCapability("platformName", "Android");
capabilities.setCapability("deviceName","S5");
capabilities.setCapability("platformVersion", "4.4.2");
capabilities.setCapability("app", app.getAbsolutePath());
capabilities.setCapability("app-package", "packagename");
capabilities.setCapability("app-activity", "activity");
drivers = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
Set contextNames = drivers.getContextHandles();
for (String contextName : contextNames) {
System.out.println(contextNames); //from the drivers.getContextHandles i am getting only "NATIVE_APP"
}
drivers.context(contextNames.toArray()[0].toString()); //
rivers.findElement(By.xpath("//android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout"));
drivers.findElement(By.className(“android.webkit.WebView”))
–From here i couldn’t able to navigate
drivers.findElement(By.xpath("//android.view.View[@index=‘0’]"));
i have tried with drivers.switchto.window(“NATIVE_APP”) but haven’t worked.
please guide me.