Compare Strings

var str1 = “Dimension Data”
var str2 = “Data planet”

I want to compare the above strings and set the condition to true even(as the word data is present in both the strings) if part of the string is matching. Could you please let me know how can this be done?

Output must be true even if part of the string is matches.


if you want to just check weather both variables have the word data you can use if
str1.ToString.ToLower.Contains(“data”) and str2.ToString.ToLower.Contains(“data”)

if there are multiple words in your string then use split string then loop the array one by one check Str2.ToString.Contains(ArryElement)

See if this helps your case matchString.xaml (6.9 KB)

1 Like

Thank you @Divyashreem for your idea. Yes, the words changes dynamically not looking for a word “data”

@nadim.warsi Thank you very much. It works as I expected.

1 Like

Welcome @Boopathi :slight_smile:

@nadim.warsi Hi I have an another doubt in data scrapping. If possible, could you please suggest on this? Only 3 rows collected

  2. Need to collect the highlighted data. have some 30 - 40 food items in a page but only 3 rows are updating using data scrapping.

Let me try this out and update you

@nadim.warsi Thank you.

This is your logic…

Each frame will be collected based on Idx = ‘49’.

Your selector as follows:

Take a loop and increment idx value with a counter variable then your selector will be like this.

Here you have to remember the logic first Frame idx=49 Increment 8 for 2nd frame increment 8 for 3rd frame.
for each 4th frame you have to increment 8+1.

So idx values will be like this: idx=49, 57, 65 74,82, 90, 99…etc (1,2,3,4,5,6,7…etc )
once you loop with this logic in get text activity then you can get all text information in a string(image will be ignored). Once you get the string value then you can do string manipulations.

Hope my inputs are useful…

@rkelchuri Thank you but still not clear. why idx 8 needs to incremented to get the second listed food item. My selector shows idx as 1 using IE for the first frame.

I have used Google Chrome Browser. When you spy on the web elements with UiExplorer then you can see consistent increment on the idx value… to grab specific area of frame.

Why we need to select specific frame instead of specific text.
You have to see consistent property where it should not change while loading. So, each time we have to collect only specific constant or stable property. This will never change. also it will increase and decrease depends on size of the data. so, every iteration we can get accurate text from the specific frame area.

Hope my inputs are useful.

@rkelchuri Thank you. It is really helpful. I am just trying out and also put counter value but only one food item lists when i run the file. Used find children activity.


Please use google chrome not IE… because idx values will get change… for browser to browser.

please use get text activity and keep an output variable… and use message box to show grabbed text.

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