Error: Object reference not set to instance of an Object while Getting Value from Web

Hi All,

I am trying to get text from web using GetValue activity to validate the invalid credentials. Until todaymy workflow was working fine in prod.

I am getting an error on GetValue activity and when troubleshooting the issue, output string of getvalue activity is returning null whereas I am using the right credentials and invalid credentials message is not coming on web, therefore my workflow should ho into else part of condition where I am validating the string.

Can any one help me why I have started getting this issue all of sudden and what could be the possible solution?

Hi @skg_161125

Try to print the value of InvalidCredentials in log message and see if it’s null.

Here is the output, nothing is printing.


What is it showing in the debug section (local)?

it is displaying null for invalidcredential string.

It should not be null. The problem may be with the selector. Try to highlight the element and see if it is highlighting the right ui element.

Yes, It is highlighting the right Ui element. Selector is working fine. Workflow was working fine until yesterday. started seeing issue from the morning execution. I have explored all my options. Could nt find the root cause.

Can you share the selector.
Try by increasing the timeout of the Get Text Activity.

can you share a screenshot of the expanded properties pane?
Do you have continue on error by any chance? Timeout seems short so it should throw error if not found but not if continue on error
Sometimes it also happens if you have the same variable name defined in different scopes.

Continue on Error is enabled. I dont have same variable anywhere else in the flow.

So the adjust the timeout i guess.
Remove continue on error since your remaining workflow is dependent on the output from here.
Essentially during the bot run, this activity it timing out but the exception is being silenced. Therefore your variable is null.

After changing as suggested above, error changed to below and occurring on GetValue activity instead of if condition.

Check for Invalid Credentials Message: Could not find the UI element corresponding to this selector:
webctrl tag=‘B’/>

howevere, it will not find the selector as credentials are working and workflow is navigating to homepage.

i would use Element exist instead.
or put it in a try catch, with proper handling

It cannot find the ui element. You need to configure the selector again so that it selects the right ui element.

do you know what could be the root cause of same code not working all of sudden when it was working in production for months?

What is the tag value it is showing now? (webctrl tag)

Maybe the website updated, which is normal for websites.
You selector needs to be more specific. just having Tag <B> wouldn’t be ideal

Hi @skg_161125,

What type is your null variable? String? If so, try setting the variable as "" and then getting the text. This will set the variable as something other than null that confirms that the get text is not working as expected.

Yeah, I did that so that it doesn’t take null even the text doesn’t exist. Since my credentials are working, I have added a if condition, if successful login, it will not check for invalid credentials. This should be added at the first place.