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 to use variables.

shamsham Members
edited October 2011 in Sahi - Open Source
Hi all,

I'm having a script like this..
_include("_sahi-common.sah");
_include("_ip_addr.sah");

_click(_span("Auto Services"));
_click(_link("Create[3]"));
_setValue(_textbox("custom_name"), "newtestsync");
_setSelected(_select("multi_dest-0.host"), $valid_ip);
_setValue(_textbox("multi_dest-0.target"), "ttttttttttttttttttttttttt");
_click(_submit("Create Service"));
_assertExists(_listItem("Invalid URL: zfs+rr: destination dataset \"$valid_ip:/ttttttttttttttttttttttttt\" not found"));

//exit
logout();

$cat ../../_ip_addr.sah
// This script defines Valid IP addresses to be used for
var $valid_ip = "10.0.0.23";

The issue here is with "$valid_ip at _assertExists. I cant seem to get its value no matter what i try.
Any ideas ?

Thanks

OS:: ubuntu 11.04
sahi version=3.5

Comments

  • shamsham Members
    Anyone with a suggestion please..
    its a fairly urgent thing for me.. I've gone mad trying to figure out the right approach.
  • minmin Members
    edited October 2011
    Hi Sham,

    how about changing your script like this:

    function function_name($valid_ip){
    _click(_span("Auto Services"));
    _click(_link("Create[3]"));
    _setValue(_textbox("custom_name"), "newtestsync");
    _setSelected(_select("multi_dest-0.host"), $valid_ip);
    _setValue(_textbox("multi_dest-0.target"), "ttttttttttttttttttttttttt");
    _click(_submit("Create Service"));
    _assertExists(_listItem("Invalid URL: zfs+rr: destination dataset \"$valid_ip:/ttttttttttttttttttttttttt\" not found"));
    }

    function_name("10.0.0.23");

    hope it would help.

    Cheers,

    Min
Sign In or Register to comment.