Vaibhav Joshi
Vaibhav Joshi

Reputation: 221

How to identify the text color and background in Calabash-Android

Is there any possible way to get the text color or background color of any particular text in Calabash-Android. I query in irb for same but doesn't get the required output. I think for IOS there is given methods to identify the color, but in Android it's limitation.

I have tried with text, id, index of particular text and apart form that I reached to github, forums pages but still scratching. does anybody got way in this scenario, if its kindly help.

Thanks in an advance Vebhrocks

Upvotes: 0

Views: 825

Answers (1)

Tobias
Tobias

Reputation: 678

getTextColors is a method available for any textview. It should be useful when the entire textview has the same colour.

query("...", :getTextColors)

To get the background colour you could do something like query("...", :getBackground, :getColor)

If you need to do advanced computations, consider making a backdoor method.

I do, however, think this might be outside the scope of a UI test. Consider using a different approach of testing this instead of using a UI test framework. A simple unit test might suffice.

Upvotes: 3

Related Questions