I'm trying to fill a form using selenium where a postcode is entered then a dropdown appears with all the addresses in that postcode appear. I'm taking the data from a spreadsheet. when i split the address to take [0] the house name or number, i want to use this to select from the dropdown the correct address. The dropdown lists the full address, i cannot search for the whole address as the ones in my spreadsheet may differ slightly i.e town may be missing.
How would i select by just matching the house name number?
HNUM = sheet['B1']
HNUM = HNUM.value
HNUM = HNUM.split()
HNUM = HNUM[0]
dropdown = browser.find_element_by_id('confirmAddressLookup')
housenumElem = Select(dropdown)
housenumElem.select_by_value(HNUM)
The above code is not working i figure i need to somehow partially match or extract the addresses, split them, then loop through until a match? from the websites code:
Select your address
THE LONG MILL, ROCHDALE ROAD, GREETLAND, HALIFAX, WEST YORKSHIRE HX4 8AL
16 ROCHDALE ROAD, GREETLAND, HALIFAX, WEST YORKSHIRE HX4 8AL
24 ROCHDALE ROAD, GREETLAND, HALIFAX, WEST YORKSHIRE HX4 8AL
26 ROCHDALE ROAD, GREETLAND, HALIFAX, WEST YORKSHIRE HX4 8AL
59 ROCHDALE ROAD, GREETLAND, HALIFAX, WEST YORKSHIRE HX4 8AL
65 ROCHDALE ROAD, GREETLAND, HALIFAX, WEST YORKSHIRE HX4 8AL
69 ROCHDALE ROAD, GREETLAND, HALIFAX, WEST YORKSHIRE HX4 8AL
77 ROCHDALE ROAD, GREETLAND, HALIFAX, WEST YORKSHIRE HX4 8AL
83 ROCHDALE ROAD, GREETLAND, HALIFAX, WEST YORKSHIRE HX4 8AL
I think i need to loop through each value and search for the house number '24' in this example but i do not know how to implement it.