Null Exception in UIelement.Isvisible method

I am facing an issue of null exception in UIelement.Isvisible method
is Visible is boolean type why it is showing null exception

Flow is like : find text position - “one_variable” UIelement
If one_variable.isvisible
Actualy the element is not appeared on the screen
in this case it should return false why it is throwing exception

This is so urgent anyone help me with this

Hi @Sudharsan_Ka ,

Quick workaround: please try to put an IF statement before your check:
if isnull(one_variable.isvisible) then consider it as false because as you say “the element is not appeared on the screen”.

However, this is just a quick-fix and does not explain why this happens. One thing you could look at is if another element on the screen behaves in a similar manner or it is just this one. If multiple elements behave like this - it may be a problem of how you read and what you keep in that “one_variable”. What type is it and how do you initialize it?

Also, you may check with UIExplorer for another element on the screen what value the isVisible property contains. Could it be 0 or 1 instead of true/false?

Let us know. Thank you,
Constantin

cant able to give isnull in if condition

can you try to initialize the variable with the activity “find element”? it worked for me (see attached XAML)
Main.xaml (5.6 KB)
.

Constantin

Sure I will try this one

checking if it is null we can use: isNothing(one_variable.isvisible)
also we can combine it with the result if isVisible is not null by following statement:

isNothing(one_variable.isvisible) OrElse Not one_variable.isvisible

I encounter same issue, I try to use your method, however, system prompt “If: Object reference not set to an instance of an object.” ,How can solve this problem?