Use the “Invoke Method” activity to call the “GetAttribute” method of the HTML element that contains the “displayAddress” value. This will retrieve the value of the “displayAddress” attribute. Assign the result to a variable named “address”.
Use the “Assign” activity to assign the value of “address” to a variable named “addressString”. The expression would be: address.ToString()
Use the “Split” function to split the string into an array of substrings, using the comma character (“,”) as the separator. Assign the result to a new variable named “addressArray”. The expression would be: addressString.Split(","c)
Create a new datatable with four columns named “Area 1”, “Area 2”, “Area 3”, and “Area 4”.
Use the “For Each” activity to iterate over the elements of the “addressArray” array.
Inside the “For Each” activity, use the “If” activity to check if the current element starts with the string “displayAddress”. The condition would be: item.Trim().StartsWith("displayAddress")
Inside the “If” activity, use the “Assign” activity to extract the name of the area and save it to the appropriate column in the datatable. The expression would be:
If (item.Trim().StartsWith("displayAddress"))
dataTable.Rows.Add(item.Trim().Replace("displayAddress\":", "").Replace("""", ""))
End If
This code first checks if the current element starts with “displayAddress”. If it does, it removes the “displayAddress” text and any quotation marks from the element and adds the resulting string to the datatable.
After the “For Each” activity, the datatable will contain the names of all areas after “displayAddress”.
I am practicing automating a webpage so what I’m trying to do is loop through and click on every property in the URL, and extract the sell price, scroll down and extract the previous sale history.