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.

Issue regerding Error

arunbalaarunbala Members
edited February 2012 in Sahi - Open Source
Hi,
I dont know why its showing error. Eventhough i have check with controller each and every line.

my part of the script is,

if (_condition(_radio("ctl00_cphClientBody_rdolstType_0").checked))
{
_assertExists(_select("ctl00\$cphClientBody\$ddlBuyCurrency"));
_setSelected(_select("ctl00\$cphClientBody\$ddlDelInstruction"), "1");
_wait(3000, _isVisible(_select("ctl00\$cphClientBody\$ddlDelInstruction"));
_setSelected(_select("ctl00\$cphClientBody\$ddlSellCurrency"), "15");
_wait(2000, _isVisible(_select("ctl00\$cphClientBody\$ddlDelInstruction")));
_setValue(_textbox("ctl00\$cphClientBody\$txtBuyAmount"), "500");
_assert(_radio("ctl00_cphClientBody_rblDeli_0").checked);

if (_condition(_radio("ctl00_cphClientBody_rblDeli_0").checked))
{
_assertExists(_select("ctl00\$cphClientBody\$ddlDelInstruction")); (\\Syntax Error ; missing)
_setSelected(_select("ctl00\$cphClientBody\$ddlDelInstruction"), "1");
else
_assertExists(_textbox("ctl00\$cphClientBody\$txtMultipleDelivery"));
_assert(_isVisible(_textbox("ctl00\$cphClientBody\$txtMultipleDelivery")));
_setValue(_textbox("ctl00\$cphClientBody\$txtMultipleDelivery"), "2");
}
_setValue(_textbox("ctl00\$cphClientBody\$txtFieldRate"), "500");
_setValue(_textbox("ctl00\$cphClientBody\$txtFieldParty"), "Majestic");
else
_assertExists(_radio("ctl00_cphClientBody_rblAttachment_0"));
_setSelected(_select("ctl00\$cphClientBody\$ddlBuyCurrency"), 1);
_click(_button("OK"));
_setValue(_textbox("ctl00\$cphClientBody\$txtTransactionAmt"), "5000");
}


Pls look at this...

Comments

  • Hi arunbala,

    The error seems to be due to the misuse if..else condition.

    The above mentioned script has errors and i pointed out with comment statement.Please, go through it,
    if (_condition(_radio("ctl00_cphClientBody_rdolstType_0").checked))
    {
        _assertExists(_select("ctl00\$cphClientBody\$ddlBuyCurrency"));
        _setSelected(_select("ctl00\$cphClientBody\$ddlDelInstruction"), "1");
        _wait(3000, _isVisible(_select("ctl00\$cphClientBody\$ddlDelInstruction"));
        _setSelected(_select("ctl00\$cphClientBody\$ddlSellCurrency"), "15");
        _wait(2000, _isVisible(_select("ctl00\$cphClientBody\$ddlDelInstruction")));
        _setValue(_textbox("ctl00\$cphClientBody\$txtBuyAmount"), "500");
        _assert(_radio("ctl00_cphClientBody_rblDeli_0").checked);
        if (_condition(_radio("ctl00_cphClientBody_rblDeli_0").checked))
        {
        _assertExists(_select("ctl00\$cphClientBody\$ddlDelInstruction"));        (\\Syntax Error ; missing)
        _setSelected(_select("ctl00\$cphClientBody\$ddlDelInstruction"), "1"); 
        else 
        // There should’nt be any else condition without if condition
        _assertExists(_textbox("ctl00\$cphClientBody\$txtMultipleDelivery"));
        _assert(_isVisible(_textbox("ctl00\$cphClientBody\$txtMultipleDelivery")));
        _setValue(_textbox("ctl00\$cphClientBody\$txtMultipleDelivery"), "2");  
        }
            _setValue(_textbox("ctl00\$cphClientBody\$txtFieldRate"), "500");
            _setValue(_textbox("ctl00\$cphClientBody\$txtFieldParty"), "Majestic");
            //there should be no other lines between if and else condition
            // the close braces(}) has to be included here to point out the end of if statement
    else
    //if the statements in the else condition is not in parentheses,then only the first line will be executed and rest of the lines will be left unexecuted.
       _assertExists(_radio("ctl00_cphClientBody_rblAttachment_0"));
       _setSelected(_select("ctl00\$cphClientBody\$ddlBuyCurrency"), 1);
       _click(_button("OK"));
       _setValue(_textbox("ctl00\$cphClientBody\$txtTransactionAmt"), "5000");
    }
    

    Above script should be in the form of
    if{
      if{
         .........
        }else{
          ........
        }
    }else{
       .......
    }
    

    Please, ensure that the syntax has been followed in if...else condition.

    Regards,
    Theeran.
  • thnx i got it.
Sign In or Register to comment.