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.

Help - seeming could not get value of text from pop-up alert msg by API _lastAlert?

wei_changwei_chang Members
edited May 2013 in Sahi - Open Source
Hi seniors:
I have had a reference on this web-site http://sahi.co.in/w/_lastAlert,
E.g.
<input type="button" onclick="alert('abc')" value="Click Me">

I through this web page as my example to start capture text by command _lastAlert().
Step 1, I called Sahi controller,
Step2, To write those to Evaluate-expression field as below:
_click(_button("Click Me"));
_lastAlert();
Step3, opened web(http://sahi.co.in/w/_lastAlert), then to Press button {Test -->} on sahi controller,
Step4, I saw the first syntax is working that its really to click button(poped-up a alert),
and I expected it will as well as responding of alert text {abc}, unfortunately, it returned null value as showing at sahi controller.

please, could anyone ever experienced this to help me?
Really thanks in advance!!!

If question description not clear, please tell me : )

have a reference my environment as following
1. host PC: win XP - sp3
2. IE 8
3. Open source Sahi build 2013-02-06

Answers

  • Hi Wei,
    _lastAlert() will work correctly when played back from a script. So please just use it from a script.

    When played back from a script, the correct behavior should be:
    - Click of the alert will be suppressed. The alert should not appear.
    - _lastAlert() will return the correct value and not null.
  • Hi Pratyush,

    It worked well as tested as you indicated,

    Thanks
    BR
    Wei
Sign In or Register to comment.