Appium Android UI 测试 - 如何验证元素的样式属性? [英] Appium Android UI testing - how to verify the style attribute of an element?

查看:24
本文介绍了Appium Android UI 测试 - 如何验证元素的样式属性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想验证元素的样式,即文本视图中显示的文本颜色.不管是黑色的还是蓝色的ex.文本颜色或文本大小.此信息未在 uiautomatorviewer 中列出.

I would like to verify the style of an element i.e. the color of the text shown in a textview. Whether it is black or blue ex. textColor or textSize. This information is not listed in the uiautomatorviewer.

我可以使用 elem.get_attribute("text") 获取文本,因为在节点详细信息中可以看到文本值.有没有办法检查样式属性?(我可以很容易地使用直接硒来做到这一点.)

I can get the text using elem.get_attribute("text") as the text value is seen in the Node Detail. Is there a way to check for the style attributes?( I can do this fairly easy with straight selenium.)

推荐答案

更新.事实证明,使用 appium webdriver 无法做到这一点.

Update. As it turns out that cannot be done with appium webdriver.

对于那些想知道这是我从 appium 支持小组获得的答案的人:

For those of you who are wondering this is the answer I rec'd from the appium support group:

这不能由 appium 完成,因为底层 UIAutomator 框架不允许我们这样做.在应用程序的本机上下文中,这是无法完成的

This cannot be done by appium as underlying UIAutomator framework does not allow us to do so. In app's native context this cannot be done

在应用程序的 webview 上下文中,这将与下面相同,因为 webview 只不过是内部和应用程序的 chromeless 浏览器会话打印 searchBtn.value_of_css_property("background-color").

In app's webview's context this will be same as below because webview is nothing but a chromeless browser session inside and app print searchBtn.value_of_css_property("background-color").

总结对于 NATIVE CONTEXT 内的元素 ==>> 否对于 WEBVIEW CONTEXT 中的元素 ==>> 是

Summary for element inside NATIVE CONTEXT ==>> NO for element inside WEBVIEW CONTEXT ==>> YES

希望这会有所帮助.

这篇关于Appium Android UI 测试 - 如何验证元素的样式属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆