How to check Browser is open or not

Hi
I am trying to figure out how to check browser is open or not. Main problem is I am not using open or attach activity, I am using an open browser to perform my operation. Do we have any option to check particular application is running or not in my case browser.

Hi,
This one. :slight_smile:

Hi

I did not fine such activity.

Its same as below
Use either element exist or image exist depends on your working on local or citrix. :slight_smile:

I used Attach Browser Activity, placed it inside a Try and Catch Activity. It will throw an exception if the browser is not open, thats how you will know if its open or not.

So, I used an Exception variable and set it to nothing at the beginning of a sequence. After running the Try Catch Activity with the Attach Browser activity in it and if it throws an exception, save the the exception into the variable. The next activity is IF activity, you can use the code variable IsNot Nothing, which means there is an exception thrown then you can proceed with the code in Opening the Browser. If the variable is Nothing, then you can add another Attach Browser activity.

It worked for me. Hope it works for you.

1 Like

Hi @ezharul.ansari,

There are 2 ways to do this
1.Simply put Element Exist activity and target into your browser and add if activity to open your browser or continue your BROWSER.

2.check all processes and find if the browser is open and put an if activity to open your browser or continue your browser
Eg : using Microsoft edge
System.Diagnostics.Process.GetProcessesByName(“msedge”)
this will out process array and you can check the length of the array and if it’s 0 means browser not opened

Hope this helps,if it works mark. It as solution.

Regards,
Neelima.

1 Like