I use python + selenium to add some text into the text area (in DOM it is a DIV tag).
For example, I have the following text:
EVERY SINGLE picture or video you will publish with
after using send_keys() function the text inside textarea became following:
EVERY SINGLE ice o ideo o ill blih ih
Code snippet:
message = 'EVERY SINGLE picture or video you will publish with'
reply_input = WebDriverWait(driver, 10).until(
EC.presence_of_element_located((By.CSS_SELECTOR, 'div[aria-label="Message Body"]'))
)
reply_input.clear()
reply_input.click()
reply_input.send_keys(message)
The problem is, that the issue not stable to reproduce, it appears from time to time.
Does anyone know how to solve such a problem?
presence_of_element_located()doesn't ensures that the element is interactable. Instead you need to induce WebDriverWait for theelement_to_be_clickable()and you can use the following Locator Strategy:Note: You have to add the following imports :
Reference
You can find a couple of relevant detailed discussions in: