Robotframework 基于robot框架的循环多条件检入
我试图使用robot框架检查for循环中的多个条件,但它永远不会返回trueRobotframework 基于robot框架的循环多条件检入,robotframework,Robotframework,我试图使用robot框架检查for循环中的多个条件,但它永远不会返回true :FOR ${RowIndex} IN RANGE 0 ${rowscount} ${ColumnText1} Get Text //*[@id='RadSearchGrid_ctl00__${RowIndex}']/td[3] ${ColumnText2} Get Text //*[@id='RadSearchGrid_ctl00__${RowIn
: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}永远不会返回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 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}
试试这样的
: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}
我认为Run关键字sor不应该包含任何返回值。根据Should Contain failes,如果没有找到期望的值。@Würgspaß很抱歉,这是Run关键字和Return status。我认为Run关键字或不应该包含Return任何值。根据应包含失败,如果未找到预期值。@Würgspaß很抱歉,它是Run关键字,返回状态它给出错误:关键字'BuiltIn.Should Contain'预期2到4个参数,得到9。编辑答案后,请使用${bStatus}=Run关键字,返回状态Run关键字应包含${ColumnText1}${VoucherNumber}应包含${ColumnText2}${Voucherdate}并应包含${ColumnText3}${VoucherAmount}它给出错误:关键字'BuiltIn.Should Contain'应包含2到4个参数,得到9。编辑答案后,请使用${bStatus}=Run关键字并返回状态Run关键字应包含${ColumnText1}${VoucherNumber}和应包含${ColumnText2}${Voucherdate}和应包含${ColumnText3}${VoucherAmount}