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.
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
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 ?
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.
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.
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.
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.
@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.
@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!