Data Scrapping on the Web

Hi all.

I have tried to use Data Scrapping on the Web successfully. But I have one small issue.

When the program scrap data on the Web, I want it ignore and run next step if the data is empty … How to do that ?

2 picture as below… one picture with data which I want to scrap and other is empty data.
Take data from Web.xaml (21.7 KB)

Thanks you so much!

1 Like

Try to use “Element Exists” activity and scrap the empty element on it… if the empty element exist is true > exit the flow. check if that works out.

1 Like

hi @Pradeep.Robot

Sorry but I do not want to exit the flow, I want it run next step in the flow if scraped data is empty.

How to do this ?

Thanks you!

You can try using either the Element Exists or the Get Text option.

point to the data string that is shown when data is empty… Get the string value

Use a IF activity. In the condition, Say like this

StringVariable.Equals("Text That is displayed when empty")

Under the Then section, add what you want to do if there is nothing to process. Under the Else section, add what you want to do if the data is available.

Does it help?

1 Like

Hi @trunghai,

You can use “if activity” to do this check like @Lahiru.Fernando mentioned above. As the scrapped data is a datatable, you can even use the condition, yourdatatable.Rows.Count >0 in the if activity.

If you would like to scrap the next page or next tab, if the datatscrapping is failed, you can make use of a 'Do while" loop with condition yourdatatable.Rows.Count >0.
Inside the loop, use an assign activity in the beginning to clear it’s contents by initializing
your_Datatable=new system.Data.DataTable
Scrap the data and use ‘if’ activity to check the condition. If it fails, do actions to navigate to next page or location of next data to be scrapped. Thus the loop continues till you get a scrapped value.

Warm regards,
Nimin

2 Likes

Hi @nimin

Thanks so much.

I have tried with If activity OK, but I do not know how to use Do While activity in this case.

I want to check if " ExtractDataTable.Rows.Count < = 0 " then it will run next step or scrap other data.

Hi @trunghai,

If you use the data scrapping and if activity inside the “Do while” loop , then the the loop iterates till it scrap a non empty datatable, only if you navigate the control to another page to be scrapped when the condition failed in the “if statement”. So please make sure anyone of your datatable will be a non empty data. Otherwise you can use a counter along with that condition. Like ExtractDataTable.Rows.Count < = 0 or counter <5 and increment the counter by one inside the loop. So the loop will terminate after a fixed number of failures.

Warm Regards,
Nimin

2 Likes

hi @nimin

Thanks you man ^^.

1 Like

hi @nimin

Sorry man, I have one question.

When I next into the empty page, no data for scrapping. I have used IF Activity to check ExtractDataTable.row.count>0, but it take a long time to check and then run the next step.

How to reduce this time ? I want it check fast, if < 0 will go immediately next step.

Thanks you!

In the case you might need to have your flow in flowchart, and use flow decision model. So, if the element exist gives you the positive result, you can continue the flow with the “IF” condition and in “THEN” you have a choice to give exit to flow, if not leave it as it is. and in the negative result of flow condition - your usual process will be followed. hope you are clear now.

1 Like

Hi @trunghai,

Please select ‘WaitForReady’ under ‘Target’ to “None” in the property panel and try again.

Warm regards,
Nimin

Hi @nimin

I have tried to set but it still slow… take a long time to show " MessageBox " if ExtractDataTable.Rows.count <=0

Hi @Pradeep.Robot

What command to check element exist ?

there is an activity named Element exists. you can try that out… output of that is a boolean

1 Like

Hi @Lahiru.Fernando

What is command there ?

Thanks so much!

No need of a command… just create a boolean variable and give the name of that variable there… That would work fine :slight_smile:

Hi @Lahiru.Fernando

Yes, I have created a variable with name " Text "… and the condition in Flow Decision is " text.Equals(“my text”) = true " right ?

nope… you actually use .equals for string variables.

you can try this

Text = True
1 Like

Hi @Lahiru.Fernando

Thanks you so much!

1 Like

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