Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set hidden input value in Selenium?

We have hidden input fields on our form and we need Selenium to set the value of those fields. What is the best way to set the value of hidden inputs via Selenium IDE?

like image 388
Sixty4Bit Avatar asked Jan 18 '12 21:01

Sixty4Bit


2 Answers

Easiest way I could find:

Command: runScript

Value:

javascript{this.browserbot.getCurrentWindow().document.getElementById('hiddenElementId').value='TheValue'}
like image 67
Sixty4Bit Avatar answered Oct 21 '22 08:10

Sixty4Bit


Late to the party...

When you use the IDE, you can add the command type with target id=yourID and value field value, this seems to work.

Copy the text below and paste it in the IDE to try it out

<tr>
    <td>type</td>
    <td>id=yourID</td>
    <td>field value</td>
</tr>

This seems to work for me (Selenium 2.9.1)

like image 38
mark Avatar answered Oct 21 '22 07:10

mark