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.

Unable to confirm dialogue box

abourneabourne Members
edited November -1 in Sahi - Open Source
Windows XP SP3
IE 8
Sahi Build 2011-07-19

I can successfully verify that a dialogue box appears by using the following

browser.expectConfirm("A letter code is required", true);

I however want to set focus to the popup and send an OK to close the popup. Please let me know if I need to send a screen shot of the popup. The title of the popup is Information -- Webpage Dialog and it is only an OK button

Thanks

Andrew

Comments

  • Hi

    Sahi will automaticly behave as "Ok" where selected. If you need to get the text of that confirm, use _lastConfirm()

    Does that solve your issue?

    Regards
    Wormi
  • Hi Globalworming

    Thanks so much for looking into this so quickly. I did try lastConfirm and that did not resolve my issue. Attached is my code

    browser.expectConfirm("A letter code is required", true);
    browser.button("Submit").click();
    browser.lastConfirm();

    The popup is not cleared. Does the Java API support anything like sendkeys so I can send a enter keystroke

    Thanks

    Andrew
  • o.O do you really have a confirm problem? When you run your script, does a confirm pop up? Because it should not
    Javascript calls to confirm(msg) are mocked out by Sahi so that it does not stop playback.
    Sahi by default acts as if “OK” was clicked when a confirm dialog comes up.
    It is possible to make the confirm return as if it was cancelled by setting
    maybe I just misunderstood your problem...
  • That is correct. The popup does appear. It actually blocks any other code from executing until I press the enter key and then the script continues
  • As I said, this doesn't seem right to me...
    there is an API for pressing keys http://sahi.co.in/w/_keypress
    can you access the popup with the Sahi controller?

    Could any other admin please look into this? As far as I know, confirms should not pop up, should they?
  • No I cannot access the popup from the controller. I have also tried this with no luck

    Robot robot = new Robot();
    robot.keyPress(KeyEvent.VK_ENTER);

    I have inserted a screenshot of the image

    popup.jpg

    I will try and look at the code to see how this popup is being generated and will provide additional information
  • Hi,

    On further testing this seems to be related to the enviroment. Testing on another server I am able to access the popup with the Sahi controller?

    Are there any logs that can assist us with determining why the one server is not allowing Sahi to communicate with the Popup. We have reviewed the configs on both the servers and do not see any differences that would cause this

    Thanks

    Andrew
Sign In or Register to comment.