无法使用appium inspector / UI automator查找仅用于启动画面可见性/文本框的本机应用程序的ID

问题描述 投票:1回答:1

react-native目前通过accessibilityLabel支持contentDescription。这对于可点击的元素非常有用,但是在添加唯一ID后,使用appium inspector / UI automator甚至开发人员测试其他内容(例如启动画面可见性/文本框)并不是很好。

谁可以帮我这个事。

react-native appium appium-android android-uiautomator appium-desktop
1个回答
0
投票

如果在启动画面中有对比,则可以使用isDisplayed()方法检查屏幕是否显示。

public boolean isSplashScreenVisible(){
    try{
        MobileElement element = driver.findElementByAccessibilityId("automation id here");
        return element.isDisplayed();
     }catch(Expection e){
        return false;
     }
}

或者,您可以检查是否显示启动画面;

List<MobileElement> element = driver.findElementsByAccessibilityId("automation id here");
if(element.size()>0){
   //screen is displayed
}else{
  //screen is not displayed
}
© www.soinside.com 2019 - 2024. All rights reserved.