Appium Android UI testing - how to verify the style attribute of an element?

一个人想着一个人 提交于 2019-12-12 01:40:52

问题


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.

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.)


回答1:


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

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

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

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").

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

Hope this helps.



来源:https://stackoverflow.com/questions/35164413/appium-android-ui-testing-how-to-verify-the-style-attribute-of-an-element

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!