Selenium: How to copy values from field1 to field2?

蓝咒 提交于 2019-12-01 06:21:57

问题


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.


回答1:


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>


来源:https://stackoverflow.com/questions/7808378/selenium-how-to-copy-values-from-field1-to-field2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!