Use Click activity inside Invoke Code

Hi everybody,

I am using the following code into the Invoke code activity:

Dim click as
Dim clickInvoker as WorkflowInvoker

click = New Uipath.Core.Activities.Click()
click.Target.Selector = “mySelector”
click.clicktype = clicktype.CLICK_SINGLE
clickInvoker = New workflowinvoker(click)

Error that I am getting: Object reference not set to an instance of an object

After trying many times I realized that the problem is with the command clickInvoker.Invoke() because it seems that it requires some parameters that I thought were given with the selector and click type. Actually this code was made based on a solution define by @vvaidya in the following post: How to invoke other activities inside “Invoke Code” activity. However, I am getting the error above and I went through the whole post in this forum and I did not find anything that gives me a clue what the problem is.

Could someone explain to me how can I achieve to click in one element by using Invoke code?.

Thanks in advance


H @sergio85 - I am not sure but the code need a selector to be passed you need to pass the selector in here without double quotes.
click.Target.Selector = “mySelector”

1 Like

I like where @anmolk171 is going here. If you take out the quotes for mySelector and then assign it a value in the Arguments screen you should be good to go! I tested this on my end (Pulled a selector from UI Explorer to click the “New Email” button in Outlook) and can confirm that the click activity worked. @sergio85 thank you for showing off ze code! I haven’t performed a click activity like this before but I am sure I might just start using it!


1 Like

Workflow attached for reference:

Sequence.xaml (4.5 KB)

@Mr_Meeseeks - Even I will start using it and also I am trying to combine it with AutoIT.

1 Like

I can confirm if you pass a good selector there it should work fine.

Hi @anmolk171, @Mr_Meeseeks and @bcorrea,

I did what you mentioned by creating a InArgument with the value of the respective selector but unfortunately I am getting the same error. The Uipath version where I am working is 2018.4.2. Do you think that I could affect the way this solution works?. In which version have you tried this code?

I think the problem that I am getting for this routine is with clickInvoker.Invoke() because it has some arguments to pass and It is not working.

Anyway thank you so much for your help because I spent a lot days to figure out any solution.

Have a nice day


@sergio85 Can do! We’ll get this figured out. Could you upload a copy of your workflow? I tested on 19.4.4

1 Like

And also I want to highlight that I implemented in the community version 2019.10 and it works perfectly as you say. Any advise in order to execute it on Uipath enterprise edition that I mentioned above?. Thanks again for your help

Hi @Mr_Meeseeks, the code is exactly what you uploaded in this post. It is weird that It does not work in that particular version that I have in my company.