当前位置: 动力学知识库 > 问答 > 编程问答 >

Can't used Stored Variables in Selenium IDE

问题描述:

I use Selenium IDE to make some test.

When I store variable like this :

<tr>

<td>store</td>

<td>RandomProductRef</td>

<td>XXX</td>

</tr>

I can't use it sometimes like this :

<tr>

<td>type</td>

<td>css=#ctl00_ctl00_ContentPlaceHolder2_ChildPlaceHolder2_txtSearch</td>

<td>${RandomProductRef}</td>

</tr>

It type ${RandomProductRef} in the input...

I've used the same way for an auth form and its works

Someone know why ?

Thanks

网友答案:

You should set variable name to the value input of Selenium IDE:

<tr>
    <td>store</td>
    <td>XXX</td>
    <td>RandomProductRef</td>
</tr>

Then

<tr>
    <td>echo</td>
    <td>${RandomProductRef}</td>
    <td></td>
</tr>

gives XXX

网友答案:

The only reason I could see that not working, is because your selector #ctl00_ctl00_ContentPlaceHolder2_ChildPlaceHolder2_txtSearch might be invalid at the time of execution.

Make sure that that element is present at the time of executing your type action, and that should work.

网友答案:

You should change the first command to save the text "XXX" to the variable "RandomProductRef".

<tr>
    <td>store</td>
    <td>XXX</td>
    <td>RandomProductRef</td>
</tr>
<tr>
    <td>type</td>
    <td>css=#ctl00_ctl00_ContentPlaceHolder2_ChildPlaceHolder2_txtSearch</td>
    <td>${RandomProductRef}</td>
</tr>
分享给朋友:
您可能感兴趣的文章:
随机阅读: