Check image is displayed with selenium
You want to check if image is Displayed with Selenium but selenium API doesn’t really gives you any helpers to do that , so we can implement a small helper to check image is displayed with selenium.
We can actually check if the service returns the proper Mime Types in the Content-Type HTTP header. Here you can find a list with mime types.
To check the Content-Type header for image
in ruby using Net::HTTP, you should use the following code:
This piece of code will return true of false if the content type it’s an image so you can check it using mini test assertions :
There are also alternatives using xpath to check :
Happy Testing!
The post Check image is displayed with selenium appeared first on Testingrepository - Talking about selenium , and our passion.
This post first appeared on Testing Repository - Creating Testing, please read the originial post: here