I am new to xamarin UI tests. I need to get color of UIView. As i understand i need to use Invoke method, because there no another tests way to do this. I try to take color by something like
var color = app.Query(c => c.Marked("someText").Invoke("BackgroundColor"));
or
var color = app.Query(c => c.Marked("someText").Invoke("BackgroundColor").Invoke("CGColor").Value());
but it returns me object with stars-only string "******"
or crash in case of "Value"
using.
Please, tell me what I am doing wrong?
Also I'm getting "*****" for any wrong request, for example
var result = app.Query(x => x.Marked("Mark").Invoke("TextColorAAAAAAA"));
result = {object[1]} [0] "*****"
so xamarin don't know command "Background".
Update
Looks like all that time xamarin was waiting for command "backgroundColor", from small letter. But that's not resolving problem. Now it returns empty object, no even default values...
[0] {
red => [
],
alpha => [
],
type => [
],
blue => [
],
green => [
]
}
Try to use the private field
styleString
ofUIColor
like this:You should get a string rgb value:
rgb(1,2,3)
With that, you can just parse the string to get R, G and B elements out of it.