0

I'm trying to get the 11/30/2022 date from the SOA Handled Date/Time field from this site pictured here. It's not a public site, so I can't simply post the link. The text is in an input field that's filled in by default when you open the page, and it has the following HTML.

<td>
        <input type="text" name="soa_h_date" id="soa_h_date" class="readOnly disableInput" readonly="readonly">
</td>

I've tried everything and i'm just not able to pull the text no matter what I do. I've tried the following

driver.find_element_by_xpath('//input[@id="soa_h_date"]').text
driver.find_element_by_xpath('//input[@id="soa_h_date"]').getAttribute("value")
driver.find_element_by_xpath('//input[@id="soa_h_date"]').getAttribute("placeholder")
driver.find_element_by_xpath('//input[@id="soa_h_date"]').getAttribute("textarea")
driver.find_element_by_xpath('//input[@id="soa_h_date"]').getAttribute("innerText")
driver.find_element_by_xpath('//input[@id="soa_h_date"]').getAttribute("outerText")
driver.find_element_by_xpath('//input[@id="soa_h_date"]').getAttribute("value")
  • The input field is disabled. Have a look [here](https://stackoverflow.com/questions/11429070/get-the-value-of-disabled-input-using-selenium-webdriver) – Shatas Dec 01 '22 at 14:33

1 Answers1

0

Nevermind I figured it out. I had to use a javascript executor to pull the text with the following code.

element = driver.find_element_by_xpath('//input[@id="soa_h_date"]')
date = driver.execute_script("return arguments[0].value",element)