zoukankan      html  css  js  c++  java
  • 解决Appium 抓取toast(java篇)

    首先我们先看看这个gif,图中需要,要抓取的字符串--->请输入转让份数

    1、要导入java-client-5.0.0-SNAPSHOT.jar
    包的地址:链接:http://pan.baidu.com/s/1hsfydLU 密码:ktbn
     
    2、// 调用uiautomator2,获取toast,要先调用java-client-5.0.0-SNAPSHOT.jar
    (先前的java-client 包要先移出library)然后
    在初始化时加上下面这句代码调用
    //caps.setCapability(MobileCapabilityType.AUTOMATION_NAME,AutomationName.ANDROID_UIAUTOMATOR2);
     
    3、寻找的代码
     
    String toast="请输入转让份数";
    //toast 寻找测试
    try {
    final WebDriverWait wait = new WebDriverWait(driver,2);
    Assert.assertNotNull(wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath(".//*[contains(@text,'"+ toast + "')]"))));
    System.out.println("找到了toast");
    } catch (Exception e) {
    throw new AssertionError("找不到"+toast);
    }

    注意:要移出其它的java-client的包,如

     
     
     
  • 相关阅读:
    SQL*Loader-951错误
    excel导出
    zookeeper常见bug
    可编辑表格
    tree的应用
    join
    hibernate manytomany 双向
    hibernate 多对多 单向关联
    hibernate 一对多(多对一)双向
    hibernate one2many
  • 原文地址:https://www.cnblogs.com/zqinghua/p/6645758.html
Copyright © 2011-2022 走看看