send_keys to hidden elements

49 views
Skip to first unread message

swan yam

unread,
Nov 24, 2017, 6:43:20 AM11/24/17
to Selenium Users
I want to send a text to a text box of a page.

 Here is hidden element on page from salesforce:

     <textarea class="chatterTopicsEnabled groupAtMentionsEnabled publishertextarea" 
      id="publishereditablearea" 
      name="publishereditablearea" 
      role="textbox" tabindex="0" 
      title="Topics" type="text" wrap="soft" 
      data-uidsfdc="112" style="height: 208px;">Topics</textarea>
      <input type="hidden" id="publisherprompttext" name="publisherprompttext" value="Topics">

My code by which i can click the text box but can do nothing to send text: 

    textbox = [tag for tag in driver.find_elements_by_tag_name('textarea') 
               if tag.get_attribute('name') == 'publishereditablearea']
    textbox[0].click()
    textbox[0].send_keys("text")

The error message said: `element not visible.`

How can I send a text to the textbox?

Xiang Dong

unread,
Nov 26, 2017, 9:44:01 PM11/26/17
to seleniu...@googlegroups.com

it is a wrong case to send text to a hidden element because you can't do it manually, but you can use execute javascript in webdriver for this purpose.


--david




From: seleniu...@googlegroups.com <seleniu...@googlegroups.com> on behalf of swan yam <robb...@gmail.com>
Sent: Friday, November 24, 2017 7:05 PM
To: Selenium Users
Subject: [selenium-users] send_keys to hidden elements
 
--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/d79cb562-7118-4076-8f2d-0b5c4c4710f3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages