lud0h
lud0h

Reputation: 2390

Selenium: How to copy values from field1 to field2?

We are recording a test using Selenium IDE in Firefox.

We need to copy a value from a read-only field to an input field.

Is there a direct way I can refer the field or do I have to store and use it. An example would be great.

Thanks.

Upvotes: 3

Views: 6780

Answers (1)

harriyott
harriyott

Reputation: 10645

You'll need two commands, one to store and one to retrieve. Assuming the read-only field has a name of Foo and the the input field has a name of Bar, then in the three boxes for the commands:

Command: storeValue
Target: name=Foo
Value: variableName

Command: type
Target: name=Bar
Value: ${variableName}

Alternatively, the source in the file would be:

<tr>
    <td>storeValue</td>
    <td>name=Foo</td>
    <td>variableName</td>
</tr>
<tr>
    <td>type</td>
    <td>name=Bar</td>
    <td>${variableName}</td>
</tr>

Upvotes: 5

Related Questions