标题翻译
Appium: Assert splash screen
问题
我想验证启动画面上是否出现了标志。但是我找不到它的定位器,因为当我打开Appium Inspector时,标志会很快消失。
我该如何验证它?
我正在使用:
Appium版本:1.15.1
Mac OS Catalina
Java 1.8
重现步骤:
- 启动Appium Inspector
- 启动能力
- 观察启动画面,它会停留的时间很短(没有时间找到标志元素)
- 登录画面出现
英文翻译
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:
- Start Appium inspector
- Launch capabilities
- Observe the Splash screen, it will stay for a very short time (no time to find the element for logo)
- Landing Screen appears
答案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: '//android.widget.TextView[2]/android.widget.TextView[1]'
assert locator in page_source
This works only with absolute xpath.
(Syntax is in Python)
专注分享java语言的经验与见解,让所有开发者获益!
评论