RE: How to verify the Changing Images in a Website using Selenium Webdriver


Hi All,
In our application there is a scenario like ,there are some images which changes continuously from time to time.. How should we verify those images whether they are present on website or not?
Please help me.

RavinderReddy Train Asked on September 26, 2014 in Selenium WebDriver.

Nice question (Up vote for this) and have you tried this? or directly you need code?.

on September 27, 2014.

Since this question is very old, Is this still open for discussion, I found near by one working answer to this problem.  ???

on April 22, 2015.
Add Comment
8 Answers
Best answer

I’d like to suggest a general and more robust approach towards such dynamic behavior.
I dislike using waits and timeouts in hope that something will be ready – it’s error prone and the best results are achieved by a bit of cooperation with the developers.
What the developers need to do is:
– when the URL contains a special query parameter – for example /?test=true – the application/site is under test mode.
– In test mode – a child element called <test> is appended under the <body> element.
– To use you images example – whenever an image is being displayed – a test event is sent to announce it – and the image is not changed until the event is handled.
– Test even is sent by adding a child element under <test> element. You test code reads the element, handles it and deletes it – allowing the image gallery to move on.

You might get away with simple timeouts when doing functional testing – but once you start running visual tests and take screenshots you’ll need the ability to “pause” the site’s state until you’re done and ready to move on.

Train Answered on December 15, 2014.

Thank you Zavelevsky..

on December 16, 2014.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.