18 January 2026:
Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.
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
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
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
The code seems to be correct.
Kindly check the image name and the div name.
Regards
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
Kindly Try this:
assertTrue(browser.image("img.gif").in(browser.div("/selected/")).exists());
Regards
Sumitra