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.

Newby Please Please help: storing a text in a variale

FortexFortex Members
edited November -1 in Sahi - Open Source
I will try to explain:
I have a word displayed on a webpage, I want to store this word in a variable and then paste it in another text field?

Can someone please help me?

Thanks,
~Fortex

Comments

  • Hi,

    Heres' an example.. hope this helps... i will extract the text displayed as link on this page (your login name displayed as a hyperlink) and save it in a variable.
    var $txt;
    _set($txt, _getText(_link("Fortex")));
    
    Now you can use $txt to set the same text anywhere required.

    Regards,
    Pankaj.
  • Thanks pankaj...i must say you have been a lot of helping hand to others...
  • Always welcome :)
  • dennis89dennis89 Members
    edited March 2009
    I haven't tried Sahi yet, but I think I'm going to download it soon.

    Would it be possible to assign a value to a variable like this:

    var $txt = _getText(_link("Fortex"));

    edit:
    I just saw this on the site.
    "Use _set to store a variable with data from browser"

    But can anyone still leave feedback for my question, as in will it work or not.
  • Hi,

    For page dependent variables you need to use _set() otherwise the variable value will disappear as you navigate away from the page.
    So I think directly assigning the value here won't work.

    Regards,
    Pankaj.
  • Thanks for the explanation.
Sign In or Register to comment.