Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, windows and java based applications. Get your 30 day free trial.

Discuss your Sahi Pro usage patterns, best practices, problems and solutions. Help others solve their problems and seek help from the community when needed. If you need specific support on your application, please email support @ sahipro.com

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.