Below is the web table under testing. Some time rows would be 5 OR some time 25 or more.
Currently I am able to test for 1 or 2 rows with my script shown below.
I want to make it dynamic so it could test all the rows and return proper result.
1. I want to check every row one by one and get results till the last rowThen I need click on Process when it returns row with the value Good OR Excellent. My Current code to Process 1 row
${rows1} = get element count xpath=//*[@id="MonthlyReport"]/tbody/tr
sleep 2
log to console Total Rows= ${rows1}
${ProductID} Get Text xpath=//*[@id="MonthlyReport"]/tbody/tr[${rows1}]/td[1]
log to console CBID is ${ProductID}
${Status} = Get Text xpath=//*[@id="MonthlyReport"]/tbody/tr[${rows1}]/td[9]
Log to Console The ${ProductID} is with ${Status}
${Remarks} = Get Text xpath=//*[@id="tableChargebacks"]/tbody/tr[${rows1}]/td[10]
Log to Console The ${ProductID} is with ${Remarks}
Click Element xpath=//*[@id="Process"]
2. In another case I need to search all these products id by entering id in search field and then verify if searched productid is in table. Currently I am doing this but it not dynamic. I want to test through all the products and verify its returning the row of searched Product ID. My Current code to search 1 row
${ProductID1} Get Text xpath=//*[@id="MonthlyReportSearch"]/tbody/tr[${rows1}]/td[1]
log to console CBID is ${ProductID}
#Click on Search tab
Input Text //input[@placeholder='Search ...'] ${ProductID}
sleep 5
Should Be Equal ${ProductID} ${ProductID1}
IF ${ProductID} == ${ProductID1}
Log To Console Search Result is correct.
END
What do you mean by dynamic ? Using CI/CD ?
You could try using Jenkins (if you can / are allowed to) and use it to make the Jenkins task run your program daily or every hour or something.
Thoses are ideas, because I have like I mentionned before, I never had such scenarios to automate.
If I understood your question, it sound like you’re on the right path, you just need a FOR loop
I think what you are after is something like this:
${rows1}= get element count xpath=//*[@id="MonthlyReport"]/tbody/tr
sleep 2
log to console Total Rows= ${rows1}
FOR ${rowno} IN RANGE ${rows1}
${ProductID} Get Text xpath=//*[@id="MonthlyReport"]/tbody/tr[${rowno}]/td[1]
log to console CBID is ${ProductID}
${Status}= Get Text xpath=//*[@id="MonthlyReport"]/tbody/tr[${rowno}]/td[9]
Log to Console The ${ProductID} is with ${Status}
${Remarks}= Get Text xpath=//*[@id="tableChargebacks"]/tbody/tr[${rowno}]/td[10]
Log to Console The ${ProductID} is with ${Remarks}
END
Click Element xpath=//*[@id="Process"]
Thanks for your response but it is not working. With above code it is just checking first product ID and returning its details but not moving into loop to check other product IDs one by one and returning their details.
It should go to every row one by one. Log to console details for every row with Product ID, Status and Remarks. Then finally move for further action of process.
It should iterate every row unless one of the later steps in the loop fail on the first iteration or you forgot to change ${rows1} to ${rowno} inside the loop.
Can you show the result you got to confirm what went wrong?