vinu
vinu

Reputation: 191

multiple condition check in for loop using robot framework

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.

Upvotes: 1

Views: 1633

Answers (1)

Vivi
Vivi

Reputation: 431

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}  

Upvotes: 4

Related Questions