Although familiar with programming in general, I’m quite new to Kantu (and all I know of Selenium if from Kantu). It’s been an amazing journey for me using Kantu for automation. Here’s something that’s a bit complex for me but I think is very simple to implement. Would appreciate some tips and guidance.
There’s a table in the page that looks something like this (it can be 100 rows).
Here’s what I need: Given an Item ID, click on the Edit button. So if I’m given 356428, I want to automatically click the 2nd Edit button.
I’ll get the Item ID from the user via this trick Ask for user input with storeEval - UI.Vision RPA Software Forum | Discuss RPA Automation, Selenium IDE and OCR API Text Recognition, So I want to find ${!clipboard}
and click the Edit in the same row.
I’ve played around with Kantu. Using the Select/Target, I have these information which might help in giving me the solution.
If I select 356428, I get
"Target": "//*[@id=\"clForm\"]/div[3]/div/table/tbody/tr[2]/td[1]",
To click the Edit button, it would be (same row, column 7)
"Target": "//*[@id=\"clForm\"]/div[3]/div/table/tbody/tr[2]/td[7]",
So the row number in tr[n]
is the one I need to store in a variable (e.g. 170160 will be tr[3]
and so on). Let’s say targetRow = n
Then I use the above variable to click the corresponding Edit button (not sure if this is right)
//*[@id="clForm"]/div[3]/div/table/tbody/tr[${targetRow}/td[7]/u
Alternatively, the Edit also has this JS (where it starts from 0. So 356428, the 2nd item is tr[2]
or editTask(‘1’)
<td style="cursor:pointer;" onclick="javascript:editTask('1');" >
QUESTION: Is there a way that I search for “356428” and I get this as the result:
"Target": "//*[@id=\"clForm\"]/div[3]/div/table/tbody/tr[2]/td[1]",
If yes, how do I store the n
from tr[n]
into a variable so I can use it to target the Edit button.
Or do I have to use this method: Help in Dynamic table reading - #5 by rjndra - UI.Vision RPA - UI.Vision RPA Software Forum | Discuss RPA Automation, Selenium IDE and OCR API Text Recognition
Thanks
Here’s the portion of the HTML page that I need to search through:
<tbody style="height:200px;">
<tr title=" Description: " class="InactiveEven">
<td> 126339
</td>
<td> CA
</td>
<td> Warehouse
</td>
<td> 11/16/2018
</td>
<td> John Brown
</td>
<td> Some text here
</td>
<td style="cursor:pointer;" onclick="javascript:editTask('0');">
<u>Edit</u>
</td>
</tr>
<tr title=" Description: " class="InactiveEven">
<td> 356428
</td>
<td> WA
</td>
<td> Field Office
</td>
<td> 06/20/2018
</td>
<td> Michael Smith
</td>
<td> Description here
</td>
<td style="cursor:pointer;" onclick="javascript:editTask('1');">
<u>Edit</u>
</td>
</tr>
<tr title=" Description: " class="inactiveOdd">
<td> 170160
</td>
<td> NY
</td>
<td> Branch
</td>
<td> 12/20/2017
</td>
<td> Martin Wilson
</td>
<td> To be finished soon
</td>
<td style="cursor:pointer;" onclick="javascript:editTask('2');">
<u>Edit</u>
</td>
</tr>
</tbody>`