Reputation: 297
I already written something like that:
Check privileges for PDTA
${end}= Get Matching Xpath Count //*[@id="listForm:displayDataTable:tbody"]/tr
${start}= Set Variable 0
: FOR ${index} IN RANGE ${start} ${end}
\ ${status}= Run Keyword And Ignore Error Element Should Contain listForm:displayDataTable:${index} su ${index}
And the log output is:
As you can see I want to get the number of row where I could find the value 'su'. This value can be found in a row number 6. Variable ${end} equals the number of all rows in the table.
Does anyone know how to get that number? Maybe there's a keyword which could help me, isn't it? Thanks in advance !!!
Upvotes: 2
Views: 4103
Reputation: 1575
: FOR ${index} IN RANGE ${start} ${end}
\ ${Name}= Get Text listForm:displayDataTable:${index}
\ ${IsEqual}= Run Keyword And Return Status Should Be Equal ${Name} Su
\ ${RowNumber}= Set Variable ${index}
\ Run Keyword If '${IsEqual}'=='True' Run Keywords Log Rownumber is ${RowNumber} AND Exit For Loop
U can try this.
The variable ${RowNumber} gets the row number which has the text "Su".
Upvotes: 3
Reputation: 2126
As part of your FOR loop, I would add:
Run Keyword If '${status}' == 'PASS' Log ${index}
If you need to actually use it then simply set a variable or append to a list variable or something
Upvotes: 0