问题
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