Web list selection technique needed


#1

Hi,

I’m doing a project for a client and I’m getting a bit stuck. The aim is to check a number of addresses to see what broadband is available. I have already automated the procedure and it scrapes results from the webpage to an Excel file. But in certain situations my automation doesn’t work. This is the process:

https://www.productsandservices.bt.com/products/broadband-packages

  1. Open the above url
  2. Click “I don’t know my landline number” (see screenshot below)
  3. Uncheck “Remember my details…” (see screenshot below)
  4. Enter the Postcode
  5. Enter the House number

This works fine with a postcode and house number but when there is house name (like Corner Cottage) instead of a house number then the property is not found and you have to select from a list I can’t then work out how to find and select the correct entry (see below screenshot).

I attach the xaml file and a sample input/export file. Hopefully you can help me sort this out. Many thanks, Tomas

Broadband.xlsx (11.4 KB)
BTR - BT Retail.xaml (54.5 KB)


#2

Hi,

There are several ways to get around this. One is to prepare the selector as a string variable, so that you can include variable contents and other expressions. Since your input file contains the building name, you could use an expression like this to build the selector:

"<html title='BT Broadband Deals*' />" &
"<webctrl tag='LI' aaname='*" & buildingName & "*' />"

Although this puts wildcards on either side of the building name string variable, it is still case sensitive and will fail if your input does not match.

A more robust, though less succinct solution can be had using the Find Children activity on the parent item, which has tag='UL'; use UiExplorer if indicating on screen doesn’t get you there. Loop over these and use Get Attribute to extract the aaname as a String, on which you can then use methods like regex search to determine whether it is a match. The resulting UiElement variable can be the Target argument of an activity, instead of a selector argument.


#3

Thanks @sfranzen, sounds like a plan. I’ll have a look at this when I’m back from holiday and have time to research your suggestions a bit more… Best, Tomas