@dany_khanth
Have a look on the different options and its behaviour:
Powershell:
Visuals
Script:
try
{
$status = wget $url | % {$_.StatusCode.ToString()}
}
catch [exception]
{
$status = $_.Exception.Message.ToString()
}
Flow:
Details:
HTTP Activity:
HttpWebRequest API / UiPath
Visuals
myHttpRequest2 = CType(WebRequest.Create(strURL), HttpWebRequest)
myResponse = CType(myHTTPRequest2.GetResponse, HttpWebResponse )
String.Format("Status Form Code HTTPRequest: StatusCode: {0} - Description {1}", CInt(myResponse.StatusCode).toString,myResponse.StatusDescription)
Variables:
When running different cases we get following:
URL OK
URL not existing
Invalid Url
Fazit:
- we can do it with Powershell, but also can do it within UIPath
- HTTP Request Activity is limited for second case and has Status 0
- HTTP Request Coding (Option 3) is close to the Powershell
Find starter Help here:
CheckURL.xaml (12.4 KB)
CheckURL.ps1.txt (139 Bytes)