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.

How can I retreive the url of a link as Text (not element)

PachatPachat Members
edited February 2011 in Sahi - Open Source
Hi,

On a page, I have several links I want to visit
$link1=_link("Link 1").href;
$link2=_link("Link 2").href;

_alert($link1); //Correct
_navigateTo($link1,true); //Correct

_alert($link2); //Fails
_navigateTo($link2,true); //Fails either

"Link 1" is correctly visited,
But it fails to go to "Link 2"

It looks like that "Link 1" shows correctly because the link is in the initial page.
But after the move to "Link 1" page, "Link 2" is not on the "Link 1" page.

What I need for further use, is to store $link2 as Text (not element).

Any hint on how this can be acheived would be appreciated.

Comments

  • narayannarayan Administrators
    Use

    _set($link1, _link("Link 1").href);
    _set($link2, _link("Link 2").href);

    etc.

    _link("Link 1").href is an element stub.
    _set gets the value of the stub from the browser and stores it in the variable.

    Regards,
    Narayan
  • Thank you for your support.
This discussion has been closed.