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.

Get start URL

BCoelho2000BCoelho2000 Members
edited November -1 in Sahi - Open Source
Hi everyone!

Is there a way to get the start url of the tests? I'm talking about the Start url of the Playback tab and the urls inside a suite file.

Thank you all!

Comments

  • narayannarayan Administrators
    Adding
    _navigateTo("your url")
    at the start of script should take you to that url. Would that help?
  • I have a sahi suite called MySahi.suite with the following content: Test.sah http//myurl.com

    But I also have a another suite called MySahi2.suite that uses the same sahi script but with a different start url: Test.sah http//anotherUrl.com

    Now, inside the Test.sah I have to code something like this:

    if(startUrl == "http//myurl.com")
    {
    _navigateTo("bcoelho2000.blogspot.com");
    }
    else if(startUrl == "http//myurl.com")
    {
    _navigateTo("http://sahi.co.in";);
    }

    Best regards,
    Bruno Coelho
  • Is it possible to achieve this?
  • narayannarayan Administrators
    Try
    _set($startURL, window.document.location.href);
    
    as the first line in your scripts. Then
    if($startUrl == "http//myurl.com")
    {
      _navigateTo("bcoelho2000.blogspot.com");
    }
    else if($startUrl == "http//myurl.com")
    {
      _navigateTo("http://sahi.co.in");
    }
    
    Meanwhile, I am adding APIs so that a script will be aware of the context in which it is run. It will give access to the suite name, log file name, suite properties etc.

    Regards,
    Narayan
Sign In or Register to comment.