Need some info about Element Exists activity

Hi All

I have to click on a button once logged in to a page. So first i am checking through Element Exists activity if the button is loaded in the page. This activity is just after clicking the login button.

Then i have put a condition if the exist output is true. If True, click the button Else a message box that button is not loaded. I am getting the message immediately after login.

My question is by default the Element Exists should wait for 30 seconds right ? Then why its not waiting till that time and directly moving to the else part?

maybe here a problem in selector, so if he can’t found the element, then the bot will go trough the else part, check first if the selector is right
and you can in WaitForReady, select the complete propertie, and try again if it works
image

How about -
Not using an element Exists and Putting the Click Button directly in TryCatch with the desired Timeout

Try
{
// Click Activity - Wait for Ready : Complete
}
Catch - SelectorNot Found Exception
{
MEssage Box
}

1 Like

in element exist activity u will get “WaitForReady” property
make it as “COMPLETE”.

Thanks and Regards,
Parvati

You should try on element appear activity

try different values for the Target.WaitForReady property.

@kkpatel

Please read thee below properties and need any clarification please let me know this will work for you and resolve your issue:

  • Target.TimeoutMS - Specifies the amount of time (in milliseconds) to wait for the activity to run before the SelectorNotFoundException error is thrown. The default value is 30000 milliseconds (30 seconds).— If You want then increase it also.
  • Target.WaitForReady - Before performing the actions, wait for the target to become ready. The following options are available:
    • None - Does not wait for anything except the target UI element to exist before executing the action. For example, you can use this option if you want to retrieve just text from a web page or click a particular button, without having to wait for all UI elements to load. Note that this may have unwanted consequences if the button relies on elements that are not yet loaded, such as scripts.
    • Interactive/Complete - Waits all of the UI elements in the target app to exist before actually executing the action.
      To assess if an application is in the Interactive or Complete state, the following tags are verified:
    • Desktop applications - A wm_null message is sent to check the existence of the <wnd> , <ctrl> , <java> , or <uia> tags. If they exist, the activity is executed.
    • Web applications:
      a. Internet Explorer - The <webctrl> tag is used to check if the Ready state of the HTML document is set to Complete . Additionally, the Busy state has to be set to “False”.
      b. Others - The <webctrl> tag is used to check if the Ready state of the HTML document is Complete .
    • SAP applications - First the presence of the <wnd> tag verified, after which a SAP specific API is used to detect if the session is busy or not.

Cheers @kkpatel

1 Like

@bcorrea @ParasTripathi @fernando_zuluaga But why the Element Exists is not waiting for 30 seconds before moving to the else part ?

the answer can be found debugging your project in that part dude, go debug your project, you can watch which is the reason, then if you found any error, we can help you of course

because you are telling the activity to search the application as it is at that moment, as soon as it finishes searching it goes away, so it is so fast the app is not fully loaded…

Sorry, couldn’t understand. Could you explain one more time ?

Target.WaitForReady - Before performing the actions, wait for the target to become ready. The following options are available:

  • None - Does not wait for anything except the target UI element to exist before executing the action. For example, you can use this option if you want to retrieve just text from a web page or click a particular button, without having to wait for all UI elements to load. Note that this may have unwanted consequences if the button relies on elements that are not yet loaded, such as scripts.

It is happen because it is not find that element window which is describe in selector.

Please edit the selector and manage it will work.

Cheers @kkpatel

Actually sometimes it is able to click the button and sometimes not. So it is not the problem with the selector. And even if the selector is incorrect it should still wait for 30 seconds. Why is it not waiting ?

WaitForReady Interactive to wait that element.

It is INTERACTIVE.

Then debug the workflow and using breakpoint in that activity check whether actual problem arises.

If it really is interactive and it not really waiting 30 seconds and is fast to output FALSE, then your application might be harder to control, try putting a fixed delay before the element exists with like 5 seconds or more just for testing…