Check internet is working or not using uipath

uiautomation
activities
studio
uipath

#1

Hi,
I want to check whether internet is working or not before proceeding with the desired activity. Is there any activity through i can directly perform this check.
One of the possible way is to go to cmd perform ping and get result another way is to use the following code
"System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable()" store value in bool variable and use if else to perform check but every time it return true even if internet connection is not there.


How to resolve internet connection lost issue
#2

@rishimathur,

Works pretty fine .

Note : I have set the Data Type of my variable Internet to GenericValue

As per my SS1 there is Internet Connection and so it returns = “True” Check System Tray (Bottom Right)

As per my SS1 there is NO Internet Connection and so it returns = “False” Check System Tray (Bottom Right)

Hope this Helps :slight_smile:


#3

@prassin6, I really appreciate your help but its not working for me. I would suggest you to try same thing with if else condition. It wont work with that. I tried the way you shared your screen shots. It will give the output which we write in the writeline. Its not correct.


#4

CheckInternetIsAvailableOrNot.xaml (6.7 KB)
please find the WF…


#5

@rkelchuri., Nope its giving incorrect o/p


#6

Please disconnect your laptop/PC internet and run the script… you can see “False” message


#7

@rkelchuri yes i tried by disconnecting my laptop still getting the same True message. Check the latest screen shot


#8

It’s perfectly working fine for me… please check your network adopter once… and disable it… and run again.


#9

Work Flow file shared by @rkelchuri is working absolutely fine for me.


#10

@prassin6, @rkelchuri, This is something strange. My machine showing no internet connection but when i run workflow shared by @rkelchuri it always show True value for me


#11

In your machine, please check your local networks. multiple network connections might be enabled in your machine. NetworkInterface.GetIsNetworkAvailable this will always check the data packet flow. So, if your LAN is connected with a server and getting packets it always presume that you have an active connection and it will return true.

So, disable all your networks (this only possible to disable network adopter) and run the script.


#12

@rkelchuri, @prassin6… Thank you guys. I checked on another machine and its working fine over there.
Thanks for your help


#13

@rishimathur, You can try this !

Stackoverflow - Check internet connection

Reference

Might be that’s great :+1:

Regards,
Dom :slight_smile:


#14

Per Microsoft documentation, this method is checking the network interface rather than packets so there could be scenarios where this returns true and there is no network connectivity:
https://msdn.microsoft.com/en-us/library/system.net.networkinformation.networkinterface.getisnetworkavailable(v=vs.95).aspx