Hi guys i am facing this problem. I want to click on a specific row menu icon to open it and then perform the action on that specific column item. How can I do it if there are multiple rows in a table an i want to click on a specific row’s arrow on the most right to open its menu and click on Activate. I have attached the image and code below.
Create a web table of the list of menu items (you didn’t show us enough HTML to assist you there). Move through the rows of the web table to match the menu label to your expected text and then click on the column plus one.
In terms of HTML, there is no such thing. If that sounds “specific” to you, please make it doubly specific for us.
Same again. That is not specific and in HTML terms is pretty vague – at worst, almost meaningless.
Sorry, no it isn’t.
I’m also concerned about the HTML I can see. It’s not often I see
<td> appearing in the same
<tr>. If that’s not a coding error, I’d like for someone to explain to me its purpose, semantically or otherwise.
Find the parent
<table> element and dump it all here.
As for the dropdown menu thing, make sure you include the element which, when clicked, reveals the
Then we’ll be getting close to full HTML – or at least all relevant HTML.
In general, it’s easiest to locate a cell using row/column indices, then find items within the cell (such as the icon you’re trying to click on). As others have said, if you could provide more HTML in a screenshot, it would help. What we really need to see is all child elements of a sample row in the table (i.e. all elements below the
<tr> for the row, expanded so we can see the structure).
That being said, here’s an xpath that may solve your problem:
In plain english:
Find the first table on the page. If you have multiple tables on the page, you may need to provide a predicate. We can’t see that in your screenshot, so I’m just going to assume there’s only 1 table present, or at least the table you want is the first one on the page…
Locate the body of the table. We do this because sometimes, depending on the table implementation,
<tr> elements can exist in the header, and we want to filter those out.
Locate the first row of the table. You can replace the ‘1’ with another index to target another row, obviously.
Locate the sixth column within the row. Again, replace the index with the appropriate one, but from what I can tell from your screenshot, the icon you are looking for is in the 6th column. At this point, we’ve now referenced the cell at [1, 6] in the table.
Locate the first “link” within the cell. I can’t see the actual icon you are referring to in your screenshot, but it appears that it’s implemented as a link (i.e. an
<a> element). If it’s not an
<a> element, my next best guess is that its an
Try this out, but at the end of the day, we really need to see a sample of a full row, including your target icon. The second screenshot you provided is close, but we can’t see that icon.
@salman.ahmad Did this solve your issue?
Yes my issue was resolved thanks Brandon