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.

alert window

eshwineshwin Members
edited November -1 in Sahi - Open Source
Hi,
I am using this link for alert winodw clicking

http://www.javascriptkit.com/javatutors/alert2.shtml

here I am not able to click on the button which opens the alert window

browser.button("Click here>>").click();
browser.expectConfirm("Are you sure you are ok?", true);

here.click() is not working.

Comments

  • AbePetrilloAbePetrillo Members
    edited March 2012
    If your within the sahi script you have to use:

    _click(_button("Click here>>"));

    All sahi functions must be prefixed with "_", as they are actually translated into javascript by sahi. So again:

    _expectConfirm(label, value) //from documentation means:

    _expectConfirm("Are you sure you are ok?", true);

    So the code in full is:
    _click(_button("Click here>>"));
    _expectConfirm("Are you sure you are ok?", true);
    
  • eshwineshwin Members
    yeah
    _click(_button("Click here>>"));
    _expectConfirm("Are you sure you are ok?", true);

    I got this code from sahi controller.but I want to execute using java API.

    browser = new Browser("firefox");
    browser.open();
    browser.navigateTo("http://www.w3schools.com/js/tryit.asp?filename=tryjs_alert";);

    browser.button("Click here>>").click();
    browser.expectConfirm("Are you sure you are ok?", true);

    so using java I want to execute.but this click in not working.
Sign In or Register to comment.