Hi everyone!
I am working on an automation to select a contractor from a list and then click the corresponding “Work Orders” link dynamically.
Scenario
- I have 18 contractors displayed in a table UI.
- Each row contains a contractor name and a “Work Orders” link.
- The UI structure shows that all “Work Orders” links have the same class (
PODetailsHeader
) but different tableRow attributes. - My goal is to click the correct “Work Orders” link based on the user’s input contractor.
What I Have Tried
1. Dynamically Extracted tableRow
for the Contractor
I used the “Get Attribute” activity to extract tableRow
from the contractor’s name.
- Assign Activity:
contractorRow = Get Attribute("tableRow")
- Issue: Sometimes the extracted
tableRow
is incorrect or null.
2. Used a Dictionary to Store Contractors and Their Rows
Since I know there are only 18 contractors, I tried using a dictionary to store each contractor’s row manually.
- Dictionary Setup:
contractorDic = New Dictionary(Of String, String) From {
{"ACUREN GROUP INC", "1"},
{"BROCK CANADA INDUSTRIAL LTD.", "2"},
{"FLINT ENERGY SERVICES", "3"},
{"METHANEX TEST", "4"},
{"TETRAD INSULATION SERVICES", "5"}
}
- Then, I assign the row dynamically:
contractorRow = Convert.ToInt32(contractorDic(contractorName.Trim().ToUpper()))
- Issue: I keep getting
"Value cannot be null"
errors when the contractor name doesn’t match exactly.
3. Used a Dynamic Selector for “Click” Activity
Once I obtained contractorRow
, I used a dynamic selector in my Click activity.
- Selector Used:
"<webctrl class='PODetailsHeader' tableRow='" + contractorRow + "' tag='A' innertext='Work Orders'/>"
- Issue: Even when
contractorRow
is found, UiPath sometimes does not click the correct link.
4. Tried Using an Anchor, But It’s Not Available in My UiPath Version
I initially planned to anchor the “Work Orders” button to the contractor name, but my UiPath version does not support “Anchor Base” activity.
The picture shows you an idea of the interface