Home > Software design >  Access value from computed properties
Access value from computed properties

Time:08-05

I'm trying to access the value of an input box, I can see the value on the webpage; however, the HTML tag does not contain the actual value (it only contains "---"). Below the HTML tag and a link to a reference image

html element

I was able to find the actual value under Accessibility -> Computed Properties, but I'm not sure how to retrieve it from there

accessibility information

I've tried the following with no success:

print(WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.XPATH, "//input[@id='exttemp']"))).get_attribute("innerHTML"))

Output: Empty


print(WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.XPATH, "//input[@id='exttemp']"))).text)

Output: Empty


print(WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.XPATH, "//input[@id='exttemp']"))).get_attribute("value"))

Output: "---"


print(WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.XPATH, "//input[@id='exttemp']"))).get_property("value"))

Output: "---"


This is a similar question but it wasn't solved. I also found this post but the aria elements are undefined in my case.

CodePudding user response:

You can try:

driver.execute_script("document.getElementById('exttemp').disabled='';")
time.sleep(1)
print(WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.XPATH, "//input[@id='exttemp']"))).get_attribute("value"))

As you did not confirm the url, I cannot test it.

  • Related