1

I am trying to check multiple conditions in for loop using robot framework but it never returns true.

:FOR    ${RowIndex} IN RANGE    0   ${rowscount}    
    ${ColumnText1}  Get Text    //*[@id='RadSearchGrid_ctl00__${RowIndex}']/td[3]       
    ${ColumnText2}  Get Text    //*[@id='RadSearchGrid_ctl00__${RowIndex}']/td[4]       
    ${ColumnText3}  Get Text    //*[@id='RadSearchGrid_ctl00__${RowIndex}']/td[5]       
    ${bStatus}  | Run Keywords |    Should Contain |    ${ColumnText1} and ${ColumnText2} and ${ColumnText3}    | ${VoucherNumber} and ${Voucherdate} and ${VoucherAmount}
    Exit For Loop If    ${bStatus}  

${bStatus} Never returns true.

2
  • 1
    I don't think that Run Keywordsor Should Contain return any value. According to the current doc Should Contain "fails", if the expected value is not found. Commented Feb 17, 2017 at 10:31
  • @Würgspaß I am sorry , it is Run Keyword and Return Status Commented Feb 17, 2017 at 10:32

1 Answer 1

4

Try something like this

    :FOR    ${RowIndex} IN RANGE    0   ${rowscount}    
        ${ColumnText1}  Get Text    //*[@id='RadSearchGrid_ctl00__${RowIndex}']/td[3]       
        ${ColumnText2}  Get Text    //*[@id='RadSearchGrid_ctl00__${RowIndex}']/td[4]       
        ${ColumnText3}  Get Text    //*[@id='RadSearchGrid_ctl00__${RowIndex}']/td[5]       

       ${bStatus}=   Run Keyword And Return Status   Run Keywords   Should Contain   ${ColumnText1}   ${VoucherNumber}   AND  Should Contain    ${ColumnText2}   ${Voucherdate}   AND   Should Contain    ${ColumnText3}   ${VoucherAmount}

        Exit For Loop If    ${bStatus}  
Sign up to request clarification or add additional context in comments.

2 Comments

It gives error : Keyword 'BuiltIn.Should Contain' expected 2 to 4 arguments, got 9.
Edited the Answer , please use ${bStatus}= Run Keyword And Return Status Run Keywords Should Contain ${ColumnText1} ${VoucherNumber} AND Should Contain ${ColumnText2} ${Voucherdate} AND Should Contain ${ColumnText3} ${VoucherAmount}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.