Read text on web page to see if it Matches a stored variable

Hi all,

I have a variable address stored as , lets say “1234 UiPath Lane.”

What I want to do is read part of a web page and see if the address matches my stored variable for address. What activities should I use?

Thanks in advance!

have you tried with ‘get text’ and select the adresse on the webpage?

Of course, there gonna be others step to do before, as opening the webpage and going to the website.

@eonofrey Are you Able to get the Text From the Web Page, If not, Use Get text Activity and Confirm that you are getting the value you need,

Then you can use an if Condition to Compare both values Like:
addrVarFromWeb.ToLower.Trim.Equals(storedAddrVar.ToLower.Trim)

Hi @eonofrey

Use Screen Scrapping and get what text you want.

Regards,
Kommi Jeevan.

Thanks guys I was able to store it. Now, I have a new problem.
I have a list of addresses that I stored like:

1234 Athen Cir SW Loganville, GA 30052
1520 Sengefields Trail Bethlehem, GA 30620
7890 Mccarthy Cove Stone Mountain, GA 30083

I need to get the City from the addresses… but I don’t think I can use any type of string manipulation because the actual address/number of characters varies.

Any ideas on how to do this?

Hello @eonofrey

I have an idea, why don’t use var.contains(" "), than check if it matchs any of your addresses. An other way is to use regex.

Hope this helps :upside_down_face:

@eonofrey I cannot see any difference in the Address and Name part, Hence I don’t really think we can just take The Place name, but we can take both names If you are having no issues with it :sweat_smile: Also if the Place Name is a Single Word, We can take the Word before “,” if it appears always

Hey @mz3bel

When I use .contains(" ") it returns the boolean… True. Any other ideas?

ui

Hey @eonofrey

Let’s say address = " 7890 Mccarthy Cove Stone Mountain , GA 30083 " and we want to see if “address” contains “Stone Mountain”, if we do cityAddress = address.contains(“Stone Mountain”), this should return a boolean ? As Tue or False

Is this helping you ?

That contains is too specific because there are hundreds of cities I’d have to search “contains” for.

I was able to solve using string manipulation/assign to activity like this:

city = address.split(",".ToArray, stringsplitoptions.RemoveEmptyEntries)
cityAddress = city(0)
cityAddress = cityAddress.substring(cityAddress.LastIndexO(" ")+1)

Variables set to: city = string and cityAddress = string

Thanks for all your help!

1 Like

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