Having problems with your account or logging in?
A lot of changes are happening in the community right now. Some may affect you. READ MORE HERE
Highlighted
David Taggart Absent Member.
Absent Member.
379 views

Controlling script execution for browser dialogs (BrowserWaitForDlg?)

Jump to solution

Is there a way to tell Silk Performer to wait for a dialog box to appear? I find myself working in a rich web environment with quite a few spawned dialogs that I have to test for and work around.

0 Likes
1 Solution

Accepted Solutions
donbonin Absent Member.
Absent Member.

RE: Controlling script execution for browser dialogs (BrowserWaitForDlg?)

Jump to solution

This is the most common way I know of to wait/sync on objects.  Replace locator with what you are waiting for and replace other code to exit after some timeout period etc.

while (BrowserFind(HANDLE_DESKTOP , "//DIV[@textContents='Processing request.']", false, 0, true) <> HANDLE_INVALID) do

wait(5.0);

// ThinkTime(10.0, OPT_THINKTIME_FORCEEXACT);  <<<  alternative to WAIT that will register the user as "active" during an actual test run. - dbonin 7/20/2015

loop_counter := (loop_counter + 5); //inc the counter by 5 seconds

//check the loop counter and exit if we have waited more than MAX_WAIT_MINUTES minutes

if ((loop_counter/60) > MAX_WAIT_MINUTES) then

RaiseError(0, " ... <something> took too long - aborting after waiting " + STRING(MAX_WAIT_MINUTES) + " minutes", SEVERITY_TRANS_EXIT );

end;

end;

4 Replies
donbonin Absent Member.
Absent Member.

RE: Controlling script execution for browser dialogs (BrowserWaitForDlg?)

Jump to solution

This is the most common way I know of to wait/sync on objects.  Replace locator with what you are waiting for and replace other code to exit after some timeout period etc.

while (BrowserFind(HANDLE_DESKTOP , "//DIV[@textContents='Processing request.']", false, 0, true) <> HANDLE_INVALID) do

wait(5.0);

// ThinkTime(10.0, OPT_THINKTIME_FORCEEXACT);  <<<  alternative to WAIT that will register the user as "active" during an actual test run. - dbonin 7/20/2015

loop_counter := (loop_counter + 5); //inc the counter by 5 seconds

//check the loop counter and exit if we have waited more than MAX_WAIT_MINUTES minutes

if ((loop_counter/60) > MAX_WAIT_MINUTES) then

RaiseError(0, " ... <something> took too long - aborting after waiting " + STRING(MAX_WAIT_MINUTES) + " minutes", SEVERITY_TRANS_EXIT );

end;

end;

donbonin Absent Member.
Absent Member.

RE: Controlling script execution for browser dialogs (BrowserWaitForDlg?)

Jump to solution
Hemmm, just realized that you may be syncing on something more complex - but general approach may work?
0 Likes
Jonny Absent Member.
Absent Member.

RE: Controlling script execution for browser dialogs (BrowserWaitForDlg?)

Jump to solution
Hi David

The type of dialogs these dlg functions relate to are normally generated client side (file chooser, alerts, ok button for example) and usually they are immediate as long as the machine isn't running really slowly.

For other types of dialogs like new windows or popups, SP should sync these automatically provided it can detect the traffic and events that it performs sync on, although there are circumstances where this doesn't work and manual sync is required. In such a scenario Don's advice is correct.
0 Likes
David Taggart Absent Member.
Absent Member.

RE: Controlling script execution for browser dialogs (BrowserWaitForDlg?)

Jump to solution
Excellent, thanks Don!
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.