Click on a link in a table cell

I can now get the data from several tables, going through all the pages for each table. I now need to click on one of the three hyperlinks in a cell on each row. Can anyone suggest a strategy? Thanks. I wondering if I can click on the centre of the table cell and offset the click by a number of pixels. Or can I extract the hyperlinks and pick one of them? -Thanks

Hi, @iain.wadie! Can you paste some HTML here? That way we might come up with some working selectors for you.

@jani that’s a little difficult at there is personally identifiable data in the html. The class names repeat themselves in each of the cells down the table which makes getting the data harder. Is there a click on table cell method?

There’s generic “click an element identified by the given selector” keywords. For those you need to provide the selector that targets the element you want.

If the table is not huge, or if the first few rows are enough to get the idea, would it be possible to copy the HTML and manually delete the extra rows and the personal data?

Without the HTML it is very hard to provide other than generic “use a selector that targets your element” instructions.

You can get the HTML with something like Chrome’s inspector:

image

@jani
From doing some research, I could do something like:

Click Element At Coordinates xpath=//*/table/tbody/tr[${row}]/td[1] -20 -20

However because the table id is dynamic, I have to use a class term to locate the table (which is working). Can I get the table id from knowing a unique class term for the table?

I’ve managed to get the id using:
{id}= Get Element Attribute class:artdeco-models-table id log {id}

I now need to reference the table cell. I’m trying this syntax but I’m getting an error that the element is not found.
Click Element xpath=//*[@id="{id}"]/tbody/tr[{row}]/td[1]

The above actually seems to work. I got the row index wrong, when I changed it, I was able to click on the cell and get to the correct page.

1 Like