Image Verification

Webdriver and Image Verification

Can you do image verification if it loaded on webpage?

 Yes! You can verify but you cannot say that images are half loaded. To verify if image is correct then there would be some other method but code will tell you just that images are loaded on page or not.

You can send http request to that source using GET method and check the status code as 200. if that the case then your image downloaded properly and image is there. 

Please drop your comments if you think if I am missing anything. If you have other idea to do image verification, please post in comment.

17 Comments

  • Anand Somani

    October 9, 2012

    I want to capture “Months of Supply” report from below URL
    http://www.tableausoftware.com/learn/gallery/real-estate-prices

    Please let me know is it possible? and how?

    Reply
    • admin

      October 10, 2012

      Anand, its not possible to verify as far as I know for now. you can verify till “region-content” as its AJAX.

      Reply
  • Rama Sharma

    October 12, 2012

    Can we compare/verify the content of downloaded pdf?

    Reply
    • admin

      October 12, 2012

      Nope! selenium can read only HTML DOM.

      Reply
  • Atif Mahmood

    October 29, 2012

    HI everyone,
    Regarding verification of the downloaded pdf content, i would like to share my current working with you guys,.Well i am writing the automation framework with MySQL support in selenium RC java now a days.I also have to find the solution where we can compare or verify the downloaded pdf content with our verification points. . So after thinking a lot and studying the selenium API, i come to the decision that we need to introduce a parser here with the help of some java code which can help in the situation. Well i am not sure if it works or not, I am still under progress of some kind of POC. You can also think on these lines. May be this will resolve your problem.

    Reply
    • admin

      November 1, 2012

      I am kind of agree with you but we should keep in mind that verifying image or pdf is not under scope of Selenium but programming language whatever we are using.

      Reply
  • bob

    October 21, 2014

    Your code doesn’t work. Pretty obvious when you look at it

    Reply
    • Aditya

      October 27, 2014

      It’s working for many and for me as well. Let me know where you find not working.

      Reply
  • santi

    March 12, 2015

    Awesome Article, I love the excel one very much. Keep doing good work.

    Reply
  • syed

    April 22, 2015

    In order to do visual verification, you can use ‘Microsoft.Test.VisualVerification’.
    All you need to do is have a copy of the expected image and then click a snapshot of the browser and get the actual image and then use VisualVerification to assert your results.

    This technique is very reliable and you can also set tolerance levels if required to assert your result.
    Hope this is helpful, mail me if you require any assistance with Visual Verification.
    syednadeembe@gmail.com

    Reply
  • Abdullah

    June 19, 2015

    Can we verify the region exists in the web page through webdriver code?

    Reply
    • Aditya

      June 19, 2015

      Hi Abdullah,
      What kind of region are you talking about? If you like to verify inside image then not possible but you just want to verify image as a whole then you are good to go and use above or similar code. Let me know if you were asking something different.

      Reply
  • Jax

    July 30, 2015

    Nice Blog !!

    Reply
  • asmancaga.science

    November 2, 2015

    I need the code in selenium WebDriver Junit. I have a test case working on, which is related to this type of below question.

    Reply
  • naresh

    December 4, 2015

    Thank You verymuch, exactly what I was looking for…!!!

    Reply

Leave a Reply