Getting empty spaces while scraping

Hello, im doing Linkedin scraping with UiPath, then saving the scraped data in an excel sheet then a json file. i get th results like in the pictures below empty spaces :
image


Just trim it out, like name.Trim or country.Trim

1 Like

@Siwar_Ferjeni,

Use Trim method of string to remove empty spaces around the value.

Using in Assign activity like:

name= name.Trim

Thanks,
Ashok :slight_smile:

1 Like

i get this error :
image

@Siwar_Ferjeni,

On which activity exactly? Use trim after get text activity.

Thanks,
Ashok :slight_smile:

yes after the get attribute, i used assign
image

this error appearse only when the string vrbl is null
you can do an if Statement

youStrVrbl is Nothing

add in else condition the assign activity

youStrVrbl = youStrVrbl.Trim

@Siwar_Ferjeni,

The error states that the variable don’t have any value or it’s nothing. Because of it we cannot trim it.

Check this by adding a log message to print value of country variable between the get attribute and assign activities.

Thanks,
Ashok :slight_smile:

To avoid the error you can you use the inline if statement to only trim if there’s a value.

country = If (String.IsNullOrWhiteSpace(country), "", country.Trim)

image

1 Like

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