I am trying to create an automation to perform some action to a HTML page. This page contains a complex table wit a lot of divs inside divs. Every line of this page is clickable and will open another page. I have already created the automation that will perform tasks on this page that opens, but I need to automate clicking on every line on this first table first.
Analyzing the first column of this page, I have this Xpath for the first 3 cells of the first colum:
/HTML[1]/BODY[1]/TABLE[1]/TBODY[1]/TR[1]/TD[1]/TABLE[1]/TBODY[1]/TR[3]/TD[1]/TABLE[1]/TBODY[1]/TR[2]/TD[2]/TABLE[1]/TBODY[1]/TR[1]/TD[2]/TABLE[1]/TBODY[1]/TR[1]/TD[1]/DIV[1]/DIV[2]/DIV[2]/SPAN[1]/UL[1]/LI[3]/DIV[1]/DIV[2]
/HTML[1]/BODY[1]/TABLE[1]/TBODY[1]/TR[1]/TD[1]/TABLE[1]/TBODY[1]/TR[3]/TD[1]/TABLE[1]/TBODY[1]/TR[2]/TD[2]/TABLE[1]/TBODY[1]/TR[1]/TD[2]/TABLE[1]/TBODY[1]/TR[1]/TD[1]/DIV[1]/DIV[2]/DIV[2]/SPAN[1]/UL[1]/LI[4]/DIV[1]/DIV[2]
/HTML[1]/BODY[1]/TABLE[1]/TBODY[1]/TR[1]/TD[1]/TABLE[1]/TBODY[1]/TR[3]/TD[1]/TABLE[1]/TBODY[1]/TR[2]/TD[2]/TABLE[1]/TBODY[1]/TR[1]/TD[2]/TABLE[1]/TBODY[1]/TR[1]/TD[1]/DIV[1]/DIV[2]/DIV[2]/SPAN[1]/UL[1]/LI[5]/DIV[1]/DIV[2]
and this for the last cell of the first column:
/HTML[1]/BODY[1]/TABLE[1]/TBODY[1]/TR[1]/TD[1]/TABLE[1]/TBODY[1]/TR[3]/TD[1]/TABLE[1]/TBODY[1]/TR[2]/TD[2]/TABLE[1]/TBODY[1]/TR[1]/TD[2]/TABLE[1]/TBODY[1]/TR[1]/TD[1]/DIV[1]/DIV[2]/DIV[2]/SPAN[1]/UL[1]/LI[102]/DIV[1]/DIV[2]
You can see that there’s just one element varying from 3 to 102.
All cells in the first column have this HTML
<div style="float:left;" class="ajaxListColumn ajaxListColumnInternal ajaxListColumn_2 ajaxListSearchable ajaxListRowDivActionable ajaxListRowDivColumnActionItem default-to-first-column">
<span class="left">Item 1</span>
</div>
what varies from cell to cell on the first column is this Item 1, 2, 3, etc…
What I need is, to create an array of elements, so I can click them with Javascript and then perform the automation I already have on each page that will open for each click on a line of this table. How do I get this array? Thanks.
I am not sure what other informations you guys need to answer this. Please ask me and I will post here.
If you just want an XPath which will select all those rows, just take your second example and remove the “[102]”.
This will select all those LI elements.
I will update this answer if I’ve got the wrong end of the stick.