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.

RFE : Sahi can provide function to get the page title

hari19hari19 Members
edited November -1 in Sahi - Open Source
RFE : Sahi can provide function to get the page title

Right now I'm using the following code :

<browser>
function browser_getPageTitle()
{
    var $result = document.getElementsByTagName('title')[0].innerHTML;
    return $result;
}
</browser>

function getPageTitle()
{
    var $title;
    _set($title, _call(browser_getPageTitle()));
    return $title;
}
Tagged:

Comments

  • narayannarayan Administrators
    Hari,

    You could just use

    _set($title, document.title);

    and if you want to assert,

    _assertEqual("my title", document.title);

    Btw, you do not need to use _call inside _set. Just _set($varName, browserFunction()) would work.

    Cheers,
    Narayan
  • hari19hari19 Members
    Thanks for the shorter code!

    However, I would think these are functions that users would expect the framework to provide.
Sign In or Register to comment.