Appium:断言启动画面

huangapple 未分类评论54阅读模式
标题翻译

Appium: Assert splash screen

问题

我想验证启动画面上是否出现了标志。但是我找不到它的定位器,因为当我打开Appium Inspector时,标志会很快消失。

我该如何验证它?

我正在使用:
Appium版本:1.15.1
Mac OS Catalina
Java 1.8

重现步骤:

  1. 启动Appium Inspector
  2. 启动能力
  3. 观察启动画面,它会停留的时间很短(没有时间找到标志元素)
  4. 登录画面出现

Appium:断言启动画面

英文翻译

I want to verify logo appeared on the splash screen. But I can't find its locator because when I open Appium Inspector the logo disappears very fast.

How can I verify it?

I am using:<br>
Appium Version: 1.15.1<br>
Mac OS Catalina<br>
Java 1.8

Steps to reproduce:

  1. Start Appium inspector
  2. Launch capabilities
  3. Observe the Splash screen, it will stay for a very short time (no time to find the element for logo)
  4. Landing Screen appears

Appium:断言启动画面

答案1

得分: 0

你可以在打开应用后立即获取页面源代码并将其存储在一个变量中:

page_source = driver.page_source

然后,你可以断言元素是否在页面源代码中:

page_source = driver.page_source
locator = '//android.widget.TextView[2]/android.widget.TextView[1]'
assert locator in page_source

这仅适用于绝对 XPath。

(语法为 Python)

英文翻译

You can get the page_source immediately after opening the app and store it on a variable:

page_source = driver.page_source

the you can assert the element is in the page_source or not.

page_source = driver.page_source
locator: &#39;//android.widget.TextView[2]/android.widget.TextView[1]&#39;
assert locator in page_source

This works only with absolute xpath.

(Syntax is in Python)

huangapple
  • 本文由 发表于 2020年5月30日 14:51:01
  • 转载请务必保留本文链接:https://java.coder-hub.com/62098884.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定