I've been working on a project and had much success with selecting web elements using .get_attribute('value')
and .get_attribute('text')
.
I am trying to select the text from the web element in the screenshot below, but can't figure out how to select the text.
I've tried the following:
operation_instructions = driver.find_element_by_id('txtOperationDescription').get_attribute('value')
operation_instructions = driver.find_element_by_id('txtOperationDescription').get_attribute('text')
Per comments I tried the following, but they print
a blank line:
print(WebDriverWait(driver,10).until(EC.visibility_of_element_located((By.ID,"txtOperationDescription"))).get_attribute('value'))
print(WebDriverWait(driver,10).until(EC.visibility_of_element_located((By.ID,"txtOperationDescription"))).get_attribute('innerHTML'))
Interestingly when I got None
when trying the following:
print(WebDriverWait(driver,10).until(EC.visibility_of_element_located((By.ID,"txtOperationDescription"))).get_attribute('text'))
Before posting the question I tried all the different elements I thought might work such as the following:
operation_instructions = driver.find_element_by_id('txtOperationDescription').get_attribute('textarea')
But I don't see how I can select the text in this field.
Can someone help me? Please and thank you!