How to use variables for coded automation click selectors?

Hello,

I’m using click selectors in coded workflows. This is fine except for ones that need variables. In this example, I need the anchor to be set to X variable (due to it changing).

The selector looks like this:
image

I need to enter the variables into these areas, but am unsure how to do so in coded automation.
image

My current code:

screen.Click(Descriptors.Oracle_Scope.Edge__OTM.ShipmentBox, new ClickOptions
{
InteractionMode = (UiPath.UIAutomationNext.Enums.NChildInteractionMode)NInteractionMode.HardwareEvents,
ClickType = (UiPath.UIAutomationNext.Enums.NClickType)NClickType.Double
});

@David_Hernandez2

You need not add in the workflow…assign a variable in the desriptor in object repo…and assign the value to the variable during runtime…so that the value would reflect

Cheers

Have you managed to do this?

I have tried adding it directly inside the descriptor in the object repo, but no variables show up to use, even though I have plenty throughout the process. And I’ve tried running it with the variable, without validating but it does not work.

image

@David_Hernandez2

Please add variable like this {{variableTest}}

cheers

I get this message:
image

But I do have it set:

@David_Hernandez2

This is only a warning…during runtime it ahould take the value if set

Cheers

Mhm, still getting “Couldn’t find selector” error in runtime. I’ll work on it a bit more.

1 Like

@David_Hernandez2

The innertext should exactly match…to check use the same in a normal workflow and correct the selector and then use in coded

Cheers