Data Scrapping - Unable to parse data to next row in excel

Hello Team,
I’m trying to scrape the data from HP Warranty Site for each Serial Number but I’m unable to save the result in next row and values are being overwritten via UiPath.

Here is what I’m trying to do and suggest if I’m doing something wrong

  1. Visit HP Site
  2. Created Read CSV (containing Serial Numbers)
  3. add each row activity (variable) created
  4. Data Scrapping for 3 fields
    Start Date
    End Date
    Serial Number
  5. I tried both Activity Write Range & Write CSV but ivain

Thanks,
Ankit

Share the screenshots of the workflow. If possible share the workflow file

1 Like

Hello,
Varun please find the attached xaml file
Main.xaml (27.2 KB)

problem with xaml file. please share screenshots

image

Hi Varun,
Please find the below XAML images.

image

for every iteration the data is written from A1, B1 and C1.
That’s why you are getting one row.
Every time the row number must be increased i.e for 2nd time it shold be A2, B2, C2. Or simply use append range, it will take care of it.
Also have to look at the data being extracted i.e What kind of data you are extracting. Whether it is a string or data table. Because if it is a DataTable then the column index must be set accordingly.
Just try to save the output extracted from the three Extract Structured Data Activity in three different sheets of same excel using the append range activity.

Tried seems not working.

I was searching for another solution and found the data can be copy pasted from web to excel using get text activity. Would you have some recommendations around it?

That’s why I was asking about the data to be extracted. If it is a String then Get Text should be used.

Follow these steps:-

  1. Instead of Get Structured Data use Get Text.
  2. Save the value in variables (serialNo, startDate, endDate).
  3. After extraction, before clicking the ‘Check another product’ button use activity Add Data Row with array value being {serialNo, startDate, endDate} and output DataTable variable be outDT.
  4. Outside the For Each Data Row scope write the Data Table outDT to an excel file using the Write Range activity.

See the xaml attached below.

Scrape Data.xaml (15.6 KB)

Caution: You have to be careful while using the Get Text activity as it’s efficiency depends upon the selector you set and it may be so that you have to use Anchor Base activity to locate the values to be extracted from the web page.

Hello Varun,
Thank you for sharing the sample file. I tried the sample and it worked for 1st warranty check however when the second serial number is being processed I’m getting the selector error.

21.4.4+Branch.master.Sha.a8b5101efe02651274064093e9c7410fedff7696

Source: Get Text: Start Date (Get Text: Start Date)

Message: Could not find the UI element corresponding to this selector:
[1]
[2]

Search failed at selector tag:
[2]

The closest matches found are:
[90%]
[90%]
[88%]
[87%]
[74%]
[74%]
[69%]
[67%]
[67%]
[67%]

Exception Type: UiPath.Core.SelectorNotFoundException

RemoteException wrapping UiPath.Core.SelectorNotFoundException: Could not find the UI element corresponding to this selector:
[1]
[2]

Search failed at selector tag:
[2]

The closest matches found are:
[90%]
[90%]
[88%]
[87%]
[74%]
[74%]
[69%]
[67%]
[67%]
[67%]
at System.Activities.Statements.Throw.Execute(CodeActivityContext context)
at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.ActivityInstance.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)

I’m attaching here the selector snapshot’s as well. I unchecked aaname & title just to double check if the flow works. The format I’m trying to capture is Date should it be a String or another data type?

Screen capture for “Start Date”
image

Screen capture for “End Date”

image

Try to use UiExplorer. Indicate element in UiExplorer and try to look for attributes which can locate the element properly.

Did you try the repair option in the selector.?

Hi Varun,
I tried both ways using UiExplorer and repairing. I’m suspecting this is failing due to the Title which has a specific model and I’m searching the dates for multiple model’s.

any further suggestions?

Do not include the selector which contains the model. send screenshot of UiExplorer

Tried and it worked but there are additional spaces added in front of start date.
Example below

											May 23, 2019

Use trim in add data row. In row array add

startDate.ToString.Trim
endDate.ToString.Trim
serial.Tostring.Trim

image

Hello Varun,
I build another Automation for different project and getting the following error. I repeated the same steps as configured in sample xaml.

Add Data Row: Object reference not set to an instance of an object.

Is your problem solved for the project that you created this topic for?

For another project, the details are required. You can create another topic for that and provide the screenshot.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.