18 January 2026:
Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.
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.
Bringing a browser window to the foreground
Hi,
i wonder if it is possible to bring a window to the foreground when a testscript detected an error. What i'm doing currently is to get the last reached url and the browser string for reporting purposes.
Maybe anybody has an idea how it can be achieved?
Gerhard
p.s. what i'm planning is to bring a browser to the foreground and then call with _execute an external program which takes a screenshot.
i wonder if it is possible to bring a window to the foreground when a testscript detected an error. What i'm doing currently is to get the last reached url and the browser string for reporting purposes.
_set($stopURL, window.document.location.href);
_set($nagiosAgent, navigator.userAgent);
I tried the following to make a browser appear on top, but it didn't work.
_set($dummy, window.focus());
This one didn't work either:
_set($winfocus, window);
_focus($winfocus);
or
$winfocus.focus()
It looks like although i can assign window.document.location.href to a javascript variable, i can't do this with the windows object.Maybe anybody has an idea how it can be achieved?
Gerhard
p.s. what i'm planning is to bring a browser to the foreground and then call with _execute an external program which takes a screenshot.
Comments
Unfortunately is doesn't work. There is just one small difference. When Internet Explorer ist used for the test it still runs in the background, but the symbol in the windows taskbar is highlighted.
update: it works when i manually playback a script, but not when called via TestRunner.
Finally i found out: when the cmd-window where sahi.bat was started is in the foreground (it even doesn't need to have the focus, just has to be on top of all other open windows), then also the browser windows will be.
Gerhard