Naveen Chhaniwal
Naveen Chhaniwal

Reputation: 704

How to verify presence of a image in webpage by using selenium IDE?

I am using selenium IDE 1.10.0. I am trying to check presence of image in product categories. what command should i use to verify image?

Upvotes: 2

Views: 14175

Answers (3)

QArea
QArea

Reputation: 4981

There are 3 ways of doing that depending on your task (why you need this image):

1) you may wait for the image to perform some actions (e.g. wait for the button to click it): waitForElementPresent(locator). It uses timeout set in your Selenium IDE. So when element appears, your script will execute next line. If it does not appear - this case should be processed somehow (e.g. using verify - see item 2)

2) if you need to know if image is there - you may use verifyElementPresent(locator) - it returns true or false (and you may store this value). If image is not present - test will continue running (this is important!)

3) if this image is critical - use what was suggested here already: assertElementPresent(locator) - if image is not there test will stop.

P.s. I hope you know what locator means. If not - find samples, it is easy

Upvotes: 1

Ankit jain
Ankit jain

Reputation: 4318

Open selenium IDE in FF browser

Right click on the image, then you see assertelementpresent command, if you do not see this command then hover over Show all available command and select assertelementpresent

Check image here

Upvotes: 5

Pavel Janicek
Pavel Janicek

Reputation: 14738

try using

assertElementPresent //img

The second is xpath relative to image

Best way how to find out for yourself:

  • Open Selenium IDE addon
  • Right click the element you want to check
  • Hover Show all available commands
  • Try to find most suitable command
  • use that command and see what happens

Upvotes: 1

Related Questions