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.

exists statement in if loop for a popup page

b_nagapadminib_nagapadmini Members
edited November 2013 in Sahi Pro
Hi ,
Have a case were i need to check if an image icon is present inside a popup if yes need to take some action else something else.
So i taught of using if statement along with _exists:
if(_popup("/.*/")._exists(_image("iconActionSearchSpyGlass.png"))== true)
but tis is not working
if i use it like this
if(_exists(_image("iconActionSearchSpyGlass.png"))== true)
even though image is there its showed as not displayed.
what can i do for this?

Best Answer

  • Hi b_nagapadmini,

    Can you try with the below code:
    _selectWindow("your window name/pop up name")
    var $exist = _exists(_image("iconActionSearchSpyGlass.png"));


    Regards,
    Bhavitha

Answers

  • also tried tis
    if(_condition(_exists(_popup("/Modal.*/")._image("iconActionSearchSpyGlass.png"))))
    but getting error as
    _sahi.saveCondition("__lastConditionValue__0", _exists(_popup("/Modal.*/")._image("iconActionSearchSpyGlass.png"))) SahiNotMyWindowException: Window with name [/Modal.*/] not found No trace available Click for browser script
Sign In or Register to comment.