The best place to *find* answers to programming/development questions, imo, however it's the *worst* place to *ask* questions (if your first question/comment doesn't get any up-rating/response, then u can't ask anymore questions--ridiculously unrealistic), but again, a great reference for *finding* answers.

My Music (Nickleus)

20130310

sahi - how to verify elements in new window (popup)

in our company's application we have a link that opens a new google maps window showing the GPS coordinates location of a transport request party.


i want to assert that the output is correct, so here's how i did it:

/////////////////////////////////
function view_tnt_trip_event_loc($tripId, $trip_event_loc) {
    view_tnt_by_tripId($tripId);
    _click(_link($trip_event_loc));
    $google_maps_window_prefix = $trip_event_loc+" - Google Maps";
    _popup($google_maps_window_prefix)._assert(_containsText(_textbox("gbqfq"), $trip_event_loc));
}

/////////////////////////////////

$trip_event_loc is a text string GPS coordinate, e.g.: "59.7692516149341,10.25079422084966"

$google_maps_window_prefix is simply the window title, e.g.:
"59.7692516149341,10.25079422084966 - Google Maps"

gbqfq is google's id for the maps window search textbox.

NOTE: when you run a sahi script that opens a new window, a new Sahi Controller window opens up for that new window. there you can find the _popup(identifier) (window title) in the "Prefix" field in the "Record" tab of that new Sahi Controller window.

thanks to this page for pointing me in the right direction:
How to switch between child and parent windows?

No comments:

Post a Comment