I came across a certain requirement. There is a web table where new rows are added daily.I want to write an automation script in Robot Framework-Python-Selenium-Eclipse-RedEditor Plugin. Right now, I am able to get the total rows count of the table and able to get the text of particular column.

${rows} =  get element count   xpath=//*[@id="tableData"]/tbody/tr
log to console   Total Rows= ${rows}
${nameColumn}=  get text   xpath=//*[@id="tableData"]/tbody/tr[4]/td[9] 
log to console   name is =  ${nameColumn}

My Requirement: I have 10 rows today and I want to check the data of 10th row then 5 new rows get added and log to console. I have written the script to add new rows but as soon as row gets added I want to check the data and no break to check the xpath manually and every-time update the script. In other words I need the xpath to go in incremental way. My current xpath of row is;


In my script td[9]/[10] is fixed.
If 5, 6, 7 rows are getting added then xpath would be incremental like


Now how to develope a script to increament tr[] or any other way to automate it?

Thanks !

  • 1
    It's hard to understand what you are trying to do
    – PDHide
    Jun 13, 2020 at 23:23
  • My script is testing the functionality of uploading file or files. After that the uploaded file's data is displaying in a new row/rows of webtable. In same script I need to added another script which will automatically check the added row. Now problem is, I am able to test the new rows independently as its xpath is known to me. But when initial script runs then that script dont know the xpath for newly added rows.Is there any method to check every row by its xpath in incremental way? Or any other way?
    – ADS KUL
    Jun 14, 2020 at 6:27
  • what you want to check ? N what you mean by incremental way
    – PDHide
    Jun 14, 2020 at 6:49
  • I want to check the value from particular two columns for newly added rows. As its a web table I think if we use tr[] in incremental way it will give me xpath for newly added rows. OR how to locate on last row of the web table and click it?
    – ADS KUL
    Jun 14, 2020 at 14:44

2 Answers 2


I am not sure what you are trying to do , if you want to make the tr index dynamic just call a variable index.

 ${nameColumn}=  get text   xpath=//*[@id="tableData"]/tbody/tr[${index}]/td[9]

And write some logic to change value to index as you want


I got the solution.

${rows}=  get element count   xpath=//*[@id="tableData"]/tbody/tr
${Value}=    Get Text    xpath=//*[@id="tableData"]/tbody/tr[${rows}]/td[1] 

It is working for me as expected. Thanks !

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.