Send keys not working selenium webdriver python


I need to send text to description textarea. There is some predefined text which is cleared after click. I tried to use clear() or click() before sendkeys but nothing works correctly. It will send text there but it is still grey and after saving page there is error that tere is no text in description… Can I use something else instead of send keys? Thanks

Textarea looks like:

<textarea id="manage_description" class="eTextArea" name="e.description" cols="" rows="" onfocus="clearDescHint(this);" onblur="resetDescHint(this);" style="color: grey;"></textarea>

send_keys not working


enter image description here


As you mentioned send_keys("TEST") are not working, there are a couple of alternatives to send a character sequence to respective fields as mentioned below :

  1. Use Keys.NUMPAD3 [simulating send_keys("3")]:

  2. Use JavascriptExecutor with getElementById :

  3. Use JavascriptExecutor with getElementsById :


Now comming to your specific issue, as you mentioned I tried to use clear() or click() before sendkeys but nothing works correctly, so we will take help of javascript to click() on the text area to clear the predefined text and then use send_keys to populate the text field as follows:


Update :

As you mentioned sometimes it works sometimes not, so I would suggest the following:

  1. Induce ExplicitWait for textarea to be clickable.
  2. Use javascript to send the text within the textarea too.
  3. Your code will look like:

    my_string = "TEST";
    elem = WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.ID, "manage_description")))
    self.driver.execute_script("arguments[0].setAttribute('value', '" + my_string +"')", elem);

Answered By – undetected Selenium

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published