appium 如何获取 short toast

Prince0813
Prince0813
订阅者
285
文章
0
粉丝
测试交流1 270字数 78阅读0分15秒阅读模式

公司 APP 的 toast, 开发人员用的是 short toast,只有 2s, 用之前的//*[contains(@text, '登录成功')], 定位方式并不能获取到,想请下怎么获取到 toast 呢
问了下开发,用的是第三方的 Toast:com.github.getActivity:ToastUtils:9.5
Appium Server:1.15.1
jdk: 1.8

软件测试需要学什么文章源自玩技e族-https://www.playezu.com/184669.html 文章源自玩技e族-https://www.playezu.com/184669.html

 
    • 凶残的小学生
      凶残的小学生 9

      显式等待/隐式等待加了没有加了,toast_loc = (By.XPATH, “//*[contains(@text, ‘%s’)]” % msg)
      ele = WebDriverWait(driver, 5, 0.001).until(ec.presence_of_element_located(toast_loc ))appium 有个 toast 的监听方法好像,你是什么语言?这个也可以试一下,以前的时候曾经用过
      find_element_by_xpath(“//*[@class=’android.widget.Toast’]”)
      用的 python这个我也尝试过,也没抓到如果无法抓取到 toast 控件的定位信息,可以截图取 toast 区域,然后 ocr 图像识别获取吗?java 的 client 可以监听 toast 好像,但是 python 的还不清楚,你可以看文档研究一下

    匿名

    发表评论

    匿名网友
    :?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:
    确定

    拖动滑块以完成验证