Question
Centene Corporation
US
Last activity: 17 Feb 2021 10:12 EST
Web automation: Choosing a link in a table section during a for loop
I'm new to robotic automation. I've reviewed all the training materials I can find on HTML tables and keys/indexes, but I don't feel I understand the topic. So I'm not sure how to phrase this question, but I'll try:
The site I am automating has a table with one header row (match cells) and one table section of data cells. I have designed this in the HTML table designer. One cell in each data row contains a hyperlink. I've matched the hyperlink such that it appears inside the table section and matches all rows in the table section.
I have a for loop iterating over the table section. The logic is to click the link on the first row that meets the conditions. The conditions are evaluated in a C# script. So when the script returns true, the for loop breaks and attempts to return the index at which it broke. This is not working. There are two rows in the table section, and the for loop returns 2 (the second row is the one that meets the condition). I think it should be returning 1.
Secondly, I'm trying to have the automation pick the correct link given the index. It doesn't like 2 (index out of range, naturally). However, I've tried forcing the absolute index to be 1, just to see if that works, and it doesn't. It just clicks the link in the first row.
There is a key involved, but I'm not sure what that is. I think I can use the Query property? There isn't documentation about how to use that. I'd like to use Query to pick a specific absolute index??
Please help. This is a big mess and I don't know how to do this.
I'm new to robotic automation. I've reviewed all the training materials I can find on HTML tables and keys/indexes, but I don't feel I understand the topic. So I'm not sure how to phrase this question, but I'll try:
The site I am automating has a table with one header row (match cells) and one table section of data cells. I have designed this in the HTML table designer. One cell in each data row contains a hyperlink. I've matched the hyperlink such that it appears inside the table section and matches all rows in the table section.
I have a for loop iterating over the table section. The logic is to click the link on the first row that meets the conditions. The conditions are evaluated in a C# script. So when the script returns true, the for loop breaks and attempts to return the index at which it broke. This is not working. There are two rows in the table section, and the for loop returns 2 (the second row is the one that meets the condition). I think it should be returning 1.
Secondly, I'm trying to have the automation pick the correct link given the index. It doesn't like 2 (index out of range, naturally). However, I've tried forcing the absolute index to be 1, just to see if that works, and it doesn't. It just clicks the link in the first row.
There is a key involved, but I'm not sure what that is. I think I can use the Query property? There isn't documentation about how to use that. I'd like to use Query to pick a specific absolute index??
Please help. This is a big mess and I don't know how to do this.