Hi,
I want to run some action elements that I can see with the UI Automator.
As you can see, the buttons are all on a webview. I’m using my S7 Edge with Android 7.0, Appium 1.7.1 and I did a full clean install.
The only thing I can access are the elements before the webview, otherwise it’s stuck on the Finding command
The only context that I get is Native context and I can force it to use a Webview context, otherwise it crash :
[debug] [AndroidDriver] Found webviews: []
[debug] [AndroidDriver] Available contexts: [“NATIVE_APP”]
The app is coded with Cordova and use the crosswalk plugin.
My class:
public class MyFirstTest {
AppiumDriver driver;
@Before
public void setupTest() {
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("platormName", "Android");
capabilities.setCapability("deviceName", "9885b6514930495a35");
capabilities.setCapability("app", "C:/APKs/myStart_2.0.7.apk");
URL serverAddress = null;
try {
serverAddress = new URL("http://0.0.0.0:4723/wd/hub");
} catch (MalformedURLException e) {
e.printStackTrace();
}
driver = new AndroidDriver(serverAddress, capabilities);
driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);
}
@Test
public void myTest() {
//WORK
WebElement layout = driver.findElement(By.xpath("//android.widget.FrameLayout[contains(@resource-id,'android:id/content')]"));
layout.click();
// WORK
WebElement layout2 = driver.findElement(By.xpath("//android.widget.FrameLayout[@index='0']"));
layout2.click();
//DOESN'T WORK
WebElement connect = driver.findElement(By.xpath("//android.widget.Button[@index='4']"));
connect.click();
}
}
Any idea about how can I get out of it ?