I have one application under test.
In this scenario, I’m storing data from a script into a CSV file.
On a webpage, there’s a data grid with over 20 rows.
I’m attempting to input values from CSV one by one individually into a search field,
and I’m receiving a single-row result because the Product ID is unique.
However, in the table, there are two columns named Owner and Issues. Despite using the provided code, I’m not getting any results. Web table looks like below.
My requirement is to validate the values of Owner and Issue for searched Product ID.
#TableData
${rows} = get element count xpath=//*[@id="FinalSheet"]/tbody/tr
sleep 2
log to console Total Rows ${rows}
${Prods}= Read Csv File To List ProductID.csv
${ProductID}= Set Variable ${Prods[0]}
FOR ${element} IN @{ProductID}
Log To Console Product ID is ${element}
FOR ${rowno} IN RANGE 1 ${rows}
Input Text xpath=//input[@placeholder='Search ...'] ${element}[0]
Log To Console Product ID in internal loop is ${element}[0]
sleep 5
${Owner} = Get Text xpath=//*[@id="FinalSheet"]/tbody/tr[${rowno}]/td[10]
log to console Search table shows owner of ${element} is ${Owner}
${Issues} = Get Text xpath=//*[@id="FinalSheet"]/tbody/tr[${rowno}]/td[11]
log to console Search table shows issue of ${element} is ${issue}
Run Keyword And Ignore Error Should Be Equal ${Owner} MANAGER
Run Keyword And Ignore Error Should Be Equal ${Issues} NO
END
END
The problem is you’ve not said what you are getting? Without access to the application or some indication to what you are getting it’s nearly impossible for anyone to help you.
Some leading questions that may help you discover your issue:
did you get an error?
what did the error say?
what was the result of Run Keyword And Ignore Error Should Be Equal ${Owner} MANAGER?
It seems very strange to use Run Keyword And Ignore Error on a validation step, are you sure you want to do this?
You have 2 FOR loops, you evaluate ${rows} = get element count outside the outer one, but use it’s value to drive the inner one, are you sure the number of rows won’t change? From the robot code you showed it shouldn’t but from the screen shots you showed it should?
Hopefully the answers you give yourself to those questions will lead you to your solution,
As I suspected you have multiple issues, this one I already gave you the answer for.
Also as I suspected you are picking and choosing which parts of you code to show, but you are hiding sections that are relevant to the problem you are describing. I only know this because it’s not possible to get the error you mentioned above with the code you posted.
The questions I gave you in my previous post should lead you to the answers you need,
And the xpath //*[@id=“FinalSheet”]/tbody/tr[2]/td[10] should give you the blank value from the last column of the row with ID A1
So as you can see the information you’re giving us doesn’t match the errors you are getting.
I will also mention that you should take care with your indenting, as it’s all over the place in the code in your original post and robot framework (like python) is sensitive to indenting. As an example these lines should not have the same indent level:
Well, I think I am following indentation rule properly as I am following in my previous 32 scripts. OK. Can you suggest the correct code if I want ;
First value from CSV then enter it into search field then getting the row and I can validate the OWNER and ISSUES for the row. Same should be repeat till all the values from CSV are finished.
Thanks !