Jymiko
Jymiko

Reputation: 1

How to check if imageview resource is right when using robot framework + Appiumlibrary mobile testing

I have simple Android app and I try to test it with Robot Framework and appiumlibrary combo. I struggle with the imageview checks. I have one imageview and image changes based on the values ​​calculated. Can I check is the image right (expected)? For example, if the calculated result is 30, the image should be ylip.jpg. How can I check that the resource/ image is correct? I have tried many ways and test don't run or I get valuerrors.

from Robot code:

Element Should Be Visible imageView2 //* [@id="imageView2"]/image[contains(@drawable, "norm.jpg")]

From layout:

android:id="@+id/imageView2"

From activity:

else if (result >18.5 && result <=30){
image.setImageResource(R.drawable.ylip);}

Screenshot from app file:

Upvotes: 0

Views: 632

Answers (1)

Sidara KEO
Sidara KEO

Reputation: 1709

To me I think UI Element inspector can't know the image resource name. If you really want to compare image there is one library call RobotEyes you can use it to compare the image. Second solution is you have to dynamic your resource-id name in application to match your condition.

RobotEyes

Upvotes: 1

Related Questions