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.

accessing the window object

lausserlausser Members
edited November -1 in Sahi - Open Source
Hi,

at the end of my testscript i'd like to get the current url for further processing. I spent some hours trying to get this to work
var $endURL = window.document.location.href;
which gives me a "window not defined".
Finally i tried
_set($endURL, window.document.location.href);
and this works fine.
Maybe someone can enlighten me what's the difference?

Greetings from Munich,
Gerhard

Comments

  • narayannarayan Administrators
    Gerhard, the Sahi scripts run in the proxy (because they have to persist through different page loads).
    window.document.location.href is an attribute present on the browser; not on the proxy. To get any variable value from the browser on to the script runner in the proxy, we need to use _set. Hope that helps.

    Regards,
    Narayan
  • Thanks, Narayan. Now it is clear.
    Gerhard
Sign In or Register to comment.