Need help automating daily weather alert extraction

Hello everyone,

I’m currently working on an automation project with UiPath and I need your help to create a robot that can automatically retrieve daily weather alerts from the Infoclimat website.

Here’s the page I want to extract data from:
:backhand_index_pointing_right: https://www.infoclimat.fr/meteo-alerte-1-region-all-page-0-details-all-ordre-heure.html

My main goals are:

  • Schedule the robot to run automatically at specific times (e.g. 09:00 every day).
  • Extract all weather alert information on the web site.
  • Save the extracted data into a structured format (Excel, CSV, or database).

Thank you very much in advance for your help :folded_hands:

@Soudios

What’s issue here please?

We can’t provide full steps to complete the process what’s the issue or error you’ve encountered kindly share it here.
Also here I can only share some hints like use the Use application/browser activity and then extract the table which you want and use write range to write it into excel and to run the process on the 9:00 time publish the process on orchestrator then use time trigger to run it on 9:00 am

Cheers

I don’t know how to extract it with API, do you have an example of workflow plz ?

Use HTTP request activity and use GET method to extract the datas

@Soudios,

Just google it or on the Forum and you will see a lot of tutorials for it.

I think there is no API for the page i want in the website, so i want to extract the information on that page but i don’t want to use data scrapping or something visual. I prefere something on background. Do you know how can i do ?

@Soudios,

Without API? No other option we have to get that in background and without data scrapping.

I am using http request and invoke code that i will put this code :

Dim doc As New HtmlAgilityPack.HtmlDocument()
doc.LoadHtml(htmlContent)

Dim dt As New System.Data.DataTable()
dt.Columns.Add(“Heure”)
dt.Columns.Add(“Localité”)
dt.Columns.Add(“Phénomène”)
dt.Columns.Add(“Détails”)
dt.Columns.Add(“Conditions routières”)
dt.Columns.Add(“Pseudo”)

Dim rows = doc.DocumentNode.SelectNodes(“//table//tr”)

If rows IsNot Nothing Then
For Each row In rows
Dim cells = row.SelectNodes(“./td”)
If cells IsNot Nothing AndAlso cells.Count >= 6 Then
Dim heure = cells(0).InnerText.Trim()
Dim localite = cells(1).InnerText.Trim()
Dim phenomene = cells(2).InnerText.Trim()
Dim details = cells(3).InnerText.Trim()
Dim conditions = cells(4).InnerText.Trim()
Dim pseudo = cells(5).InnerText.Trim()

        dt.Rows.Add(heure, localite, phenomene, details, conditions, pseudo)
    End If
Next

End If

datatableResult = dt

but i have this error :

No compiled code to run
error BC30451: ‘htmlContent’ is not declared. It may be inaccessible due to its protection level. At line 1
error BC30451: ‘datatableResult’ is not declared. It may be inaccessible due to its protection level. At line 29 Variable ‘htmlContent’ is missing. Please use Data Manager to recreate it.

I already installed this package :

@Soudios,

If you are going to use this in production, I would advise to avoid this as this is also nothing but Web scraping which you don’t want. Changes to the website will break your code.

If you are ok to scrap the data then why not use the best practice of using native UIAutomation activities like click, get text etc. which are more reliable and would able to handle the changes more effectively.

i have this issue :

25.0.176-cloud.21157+Branch.release-s176.Sha.909eebf68b5907072f43325f70b5867734fa8463.909eebf68b5907072f43325f70b5867734fa8463

Source: Invoke Code

Message: Exception has been thrown by the target of an invocation.

Exception Type: System.Reflection.TargetInvocationException

in Alerte Meteo.xaml
at InvokeCode “Invoke Code”
at Sequence “Sequence”
at Sequence “Alerte_Meteo”
at Alerte_Meteo “Alerte Meteo”

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
—> System.ArgumentNullException: Value cannot be null. (Parameter ‘html’)
at HtmlAgilityPack.HtmlDocument.LoadHtml(String html) in C:\GitHub\html-agility-pack\src\HtmlAgilityPack.Shared\HtmlDocument.cs:line 850
at UiPathCodeRunner_da4353ea07954183a6670a3874559b28.Run(String htmlContent, DataTable& datatableResult)
at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
at System.Reflection.MethodBaseInvoker.InvokeDirectByRefWithFewArgs(Object obj, Span1 copyOfArgs, BindingFlags invokeAttr) --- End of inner exception stack trace --- at System.Reflection.MethodBaseInvoker.InvokeDirectByRefWithFewArgs(Object obj, Span1 copyOfArgs, BindingFlags invokeAttr)
at System.Reflection.MethodBaseInvoker.InvokeWithFewArgs(Object obj, BindingFlags invokeAttr, Binder binder, Object parameters, CultureInfo culture)
at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object providedArgs, ParameterModifier modifiers, CultureInfo culture, String namedParams)
at System.Type.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object args)
at UiPath.Activities.System.Utilities.InvokeCode.CompilerRunner.Run(Object args)
at UiPath.Activities.System.Utilities.InvokeCode.NetCodeInvoker.Run(String userCode, List1 inArgs, IEnumerable1 imps, Object args)
at UiPath.Core.Activities.InvokeCode.Execute(CodeActivityContext context)
at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)

this is my code :

hi, @Soudios Your error means the variable you pass to LoadHtml is empty or null. Most likely, the HTTP Request didn’t return any data, or your output variable is not mapped correctly. Check that your html content variable has real data before running the Invoke Code step—add a Log Message or Write Line to see its value. If it’s blank, fix your HTTP Request settings or the output mapping.

this is what i have on the log message :

{
“message”: “180571”,
“level”: “Information”,
“logType”: “User”,
“timeStamp”: “11:11:05”,
“fileName”: “Alerte Meteo”,
“jobId”: “4b17aaa3-4db8-424f-8012-638768f53d50”,
“robotName”: “jabari@hotmail.com-attended”,
“machineId”: 2958357,
“userKey”: “ba200979-bd09-45a2-a09f-d978d0456311”,
“processVersion”: “1.0.2”,
“organizationUnitId”: 2632966,
“businessOperationId”: “9cd5e3efe2d019e5ba82cb210e64feca-d2cdcfec230b4f149601964b3c9fff96”

}

hi, @Soudios Make sure you pass the actual HTML string variable to the htmlContent argument in the Invoke Code activity. If this is empty or not linked, you’ll get the null value error. So check the argument bindings and put your HTML variable in the Value field for htmlContent. This will fix the problem.

i linked but now i can’t open the excel file, the file is corrupted :


i linked the argument :

@Soudios Don’t use both “Write Range Workbook” and “Write CSV” for the same file if you want an Excel (.xlsx) file—this will corrupt it. Pick one:

  • Use only Excel activities like “Write Range”/“Use Excel File” for .xlsx files.

  • Use “Write CSV” for .csv files only.

If you’re creating an Excel file, remove the Write CSV activity. If you’re making a CSV, give it a .csv extension instead.

i have this stranger caracteres do you know how can i fix it ?

@Soudios Those strange characters are usually caused by encoding issues with CSV files. Try setting the encoding to “utf-8” in the Write CSV activity. Also, open the CSV in Excel by going to “Data” > “From Text/CSV”, choose your file, and set File Origin to “65001: Unicode (UTF-8)”. This should fix the display problem.

i have this in excel file not in CSV file

@Soudios check if your input data has any hidden or unsupported special characters. clean the data before writing it. If you read this from another file, make sure the encoding was set to “utf-8”. make sure you read it using “utf-8” encoding.

If it keeps happening, share what activity you used to create the file—so we can help you better troubleshoot!