18 January 2026:


This forum is now archived and is in read-only mode. Please continue discussions on our improved new Sahi Pro Community forum.



Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.

Assertion failure for image icon recognition in a div

MeghaMegha Members
edited November -1 in Sahi - Open Source
Hi,

I am unable to verify if the image icon exists on a particular div. The assertion is failing even if the element exists on the div. I have used the following code.

assertTrue(Browser.image("img.gif").in(browser.div("/selected/")).exists());

Please guide me.

Thanks,
Megha

Comments

  • SumitraSumitra Members
    Hi Megha,

    The code seems to be correct.

    Kindly check the image name and the div name.

    Regards
    Sumitra
  • MeghaMegha Members
    Hi Sumitra,

    The image name and div name are both correct. I can see them on firebug. But I get Sahi error saying the image is not found on the particular div. Otherwise if I give an assertion for the image exists on browser, the assertion passes.

    Please guide me.


    Thanks,
    Megha
  • SumitraSumitra Members
    Hi Megha,

    Kindly Try this:

    assertTrue(browser.image("img.gif").in(browser.div("/selected/")).exists());

    Regards
    Sumitra
Sign In or Register to comment.