1

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

Code-Apprentice
  • 81,660
  • 23
  • 145
  • 268
deb
  • 21
  • 1
  • 6
  • Have you tried `elem.get_attribute("textColor")`? – Code-Apprentice Feb 02 '16 at 21:52
  • List of attributes currently accessible `async, autofocus, autoplay, checked, compact, complete, controls, declare, defaultchecked, defaultselected, defer, disabled, draggable, ended, formnovalidate, hidden, indeterminate, iscontenteditable, ismap, itemscope, loop, multiple, muted, nohref, noresize, noshade, novalidate, nowrap, open, paused, pubdate, readonly, required, reversed, scoped, seamless, seeking, selected, spellcheck, truespeed, willvalidate` – Naman Feb 03 '16 at 12:16
  • Thanks for responding. @Code-Apprentice using print 'The button color "%s" '%(gramsBtn.get_attribute("textColor")) issued an error. So it would seem that if the attribute is not listed in the uiautomatorviewer it cannot be used. ??? I also tried textSize. Same result an error of element cannot be located with such parameter... (Now,using that same color and using just "text" will fetch the text because that attribute is listed.) – deb Feb 05 '16 at 18:53
  • Please edit your question with these extra details. As you can see comments allow only limited formatting. – Code-Apprentice Feb 05 '16 at 18:58
  • @Code-Apprentice I have tried elem.get_attribute('textColor') it doesn't work. I am assuming this feature do not work. Thanks for responding. – deb Feb 05 '16 at 22:01

1 Answers1

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.

deb
  • 21
  • 1
  • 6