How to go last row of the webtable using robot framework

I want to click on last row of a web table.
How to locate it automatically without putting its xpath manually?


you could get all elements of the table with an css or xpath that finds all and the click on the last one.

${all_elements}    Get WebElements    xpath://what/ever/you/need
Click Element    ${all_elements}[-1]

Below was working for me but after sometime it started giving few error.

${Value}    Get Table Cell    xpath=//*[@id="tableData"]    ${rows+1}    10     

log to console Value in mentioned cell is ${Value}
I changed to it;

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

You said that you want to click on the last row.
If it works also that you can click on a specific cell, and it is a real html table,
you could go for Get Table Cell

${last_row_cell}     Get Table Cell    xpath=//*[@id="tableData"]    -1    1
Click Element    ${last_row_cell}

I do not understand why now Get Text is used and where ${rows} is coming from but ok.

1 Like

Ya, I got that.

Thanks !

I am facing another issue in file import in python modal pop up where there is no ‘input’ tag and hence I am not able to use choose file. I use auotit library but it’s working is fluctuating manner. sometime It uploads file and sometime it gives as file name is not valid after file explorer opens and in file name field my file path appears and clicks on open.

Yes i saw this othe rthread but can not help with this. Sorry!

Please do not cross post this stuff.

@René Thanks !