In order to be sure that my image is not broken, I do a GET request like this :
${temp}= Get Element Attribute //div[@class="photo_bg"]/img src
${background}= GET ${temp} expected_status=200
I only want the response code but when I execute my test, the image is “read” and on the console, there are characters like �5�����1 and my log is unreadable.
Have you an idea to only get the response code without reading the image ?
I don’t know if there is a keyword for that in RESTLibrary (this is the one you used, right?), but here is my suggestion:
${temp}= Get Element Attribute //div[@class="photo_bg"]/img src
${loglevel}= Set Log Level NONE
${background}= GET ${temp} expected_status=200
Set Log Level ${loglevel}
Your idea seems to be good but when I try it, indeed the special characters have disappeared but when the test fails (for example I put a 400 expected_status, I don’t see anymore the error message)
You have to add a different logic for different cases, for example:
${temp}= Get Element Attribute //div[@class="photo_bg"]/img src
${loglevel}= Set Log Level NONE
&{res}= GET ${temp}
IF ${res.status} == ${200}
Log Image link is OK
ELSE IF ${res.status} == ${400}
Output response body
ELSE
Log Unexpected response!
Output response
END
Set Log Level ${loglevel}