Getting an error , while fetching value from web page

If: Index and length must refer to a location within the string.
Parameter name: length


image
image
below is the value which is fetching from web page

Any suggestions or any comments earlier logic was working fine.

Thanks…

Hi @mittal.abhishek

Can you please mention your requirement in the below format? So that it will be easy understand.

Your Input:

Expected Output:

Thank you.

Hi,

Based on screenshot we don’t need substring function i guess. we can use simple replace function to get the address. please try below steps.

if → item.tostring.contains(“Address1”)

then → IvAddress = item.tostring.replace(“Address1”,"")

IvAddress = IvAddress.trim

After trying above method , values comes twice as it repeating twice on web page which i have attached earlier

image

below is the input

Output : wanted to fetch highlighted value from web page.

Hi,

In that case we have to add split condition.

if → item.tostring.contains(“Address1”)

then →

IvAddress = item.tostring.split(“Address1”)(0)

IvAddress = IvAddress.replace(“Address1”,"")

IvAddress = IvAddress.trim

More over your logic without substring that’s all. Thanks.

Hi @mittal.abhishek

You can follow what @kirankumar.mahanthi1 mentioned.

Using RegEx will be an alternative way.

image

Trim the regex output on both the ends to the expected result.

Thank you.

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