Check page exist or not using modern activities

Hi,
what is the best way to check page exist or not using modern activities because modern activity doesnt have the option to check directly page instead of that one it have check app state?

Hi @hm00776818

Have you tried with element exist aactivity?

element exist is the classic i dont want to use any classic

@hm00776818 - What I use is a combination of Try Catch and Use Application/Browser:

image

I put a Use Application/Browser inside Try. If the robot is unable to see the page despite loading with the correct URL, it will throw a System Exception:

And then in Catch, I add a System Exception catch where I add all activities I need to do if the page does not exist:

This is the most basic approach I do and there are situations where I add a Parallel activity to make the process faster especially if I know in advance what other kinds of pages could show when I attempt to load a non-existent page. Let me know if the above suggestion helps you or if you need more help.

Thanks!

its a better instead of this one use application browser we can continuous error on true and in that output we can create one element and the element type is uielement.

now i can pass this element type to check app state it will check that page is exist or not.

in this situation i dont want to go to any try catch?

Personally, I use Continue On Error = True as a last resort because using that property allows the robot to go to the next activity but we don’t have any idea what kind of error it tripped on.

By doing a Try Catch, we have a chance to systemmatically identify what the error is and safely let through only the ones that we decide can go through (like the non-existence of the page). This will allow you to save headache when the robot is live and there’s a new kind of error happening but difficult to detect because the Continue On Error = True property is just set to True.

yes i agree but is it a good practice use try/catch to detect that particular window exist to check becuse UiPath have already option use check app state?

Hi @hm00776818

Check app state activity is the replacement of all the activities mentioned below.

If your primary goal is to check whether a specific window exists, and you want a clean and efficient way to handle this scenario, it’s generally better to use the “Check App State” activity. This activity is purpose-built for window existence checking and is more straightforward.

Use try/catch blocks when you need to handle more complex scenarios or when you want to customize error handling logic beyond just checking for window existence. Try/catch blocks are powerful for managing exceptions and errors but may add unnecessary complexity if the primary goal is window existence checking.