I am trying to create a python dictionary from elements on a web page. The sleeps are in to allow my poor internet connection and the glacially slow website to catch up. So far I have
driver.get("https://my.crawley.gov.uk/en/service/check_my_bin_collection?accept=yes&consentMessageIds[]=24")
WebDriverWait(driver,30).until(EC.frame_to_be_available_and_switch_to_it('fillform-frame-1'))
WebDriverWait(driver,30).until(EC.element_to_be_clickable((By.XPATH,'//*[@id="PostcodeSearch"]')))
sleep(1)
elem = driver.find_element_by_id("PostcodeSearch")
elem.clear()
elem.send_keys("RH10 7AB")
sleep(2)
WebDriverWait(driver,30).until(EC.element_to_be_clickable((By.XPATH,'//*[@id="Choose_Address"]')))
sleep(1)
elem = driver.find_element_by_id("Choose_Address")
elem.send_keys("12")
sleep(5)
elem = driver.find_element_by_class_name("nextText")
elem.click()
sleep(3)
collection_dict = {}
collectiondetails = {"nextrubbish" : (driver.find_element_by_name("rubbishDateNext").getAttribute("value"))}
print(collectiondetails["nextrubbish"])
However I'm struggling to get a value for the rubbishDateNext result. Inspecting the element, it would appear it's not actually got a value and just a load of validation. Ideally, I'd like to have the dictionary value for nextrubbish print as Friday 26 June
How do I get this out and into Python?
driver.find_element_by_name("rubbishDateNext").getAttribute("value")?AttributeError: 'WebElement' object has no attribute 'getAttribute'