I'm trying to create a small script to tell me if addresses need a certain type of shipping.
I have a list of addresses to input into a website and it will return what type they are. Why is this returning none, even though when I check the element in selenium it's there? And technically it has to be there, to even pass the "EC.presence_of_element_located" code.
browser = webdriver.Chrome()
browser.get('courier_website')
field = browser.find_element_by_id("txt-address-auto-complete")
field.send_keys("12 test Street")
WebDriverWait(browser, 10).until(EC.element_to_be_clickable((By.XPATH, "//li[@class='ui-menu-item']/a[contains(@id, 'ui-id-')]")))
browser.find_element_by_xpath("//li[@class='ui-menu-item']/a[contains(@id, 'ui-id-')]").click()
WebDriverWait(browser, 10).until(EC.presence_of_element_located((By.XPATH, '//*[@id="delivery-details-addresstype" and text() != ""]')))
post = browser.find_element_by_xpath('//*[@id="delivery-details-addresstype"]').get_attribute('value')
print(post)
Output is "None"
HTML I'm trying to get the text out of
<table class="delivery-details">
<tbody><tr>
<th colspan="3" id="delivery-details-addresstype">Residential Delivery Zone Address</th>
</tr>
Noneis not the element, it's the attribute namedvalueof that element.get_attribute('innerHTML')?