1

情景是,

我记录了任务,即,

登录,编辑一个字段并以不同的名称保存(但原始字段仍然存在),注销。

在这里,我需要操作“名称”字段,因此我可以获得 100 个或更多具有唯一名称的副本。

在 Selenium IDE 中是否有可能?如果没有,是否有任何开源工具可以做同样的事情?

</thead><tbody>
<tr>
    <td>open</td>
    <td>/SurveyHome.aspx</td>
    <td></td>
</tr>
<tr>
    <td>clickAndWait</td>
    <td>id=ctl00_ContentPlaceHolder1_gvSurvey_ctl02</td>
    <td></td>
</tr>
<tr>
    <td>type</td>
    <td>id=ctl00_ContentPlaceHolder1_txtsurname</td>
    <td>Survey 1</td> // This is the name of the survey.
</tr>
<tr>
    <td>clickAndWait</td>
    <td>id=ctl00_ContentPlaceHolder1_btncopysurok</td>
    <td></td>
</tr>
<tr>
    <td>click</td>
    <td>id=ctl00_ContentPlaceHolder1_btncopyok</td>
    <td></td>
</tr>

</tbody></table>

如何在此代码中使用 while 循环,我尝试使用,但是 selenium ide 无法识别它。你能帮我解决这个问题吗?

4

1 回答 1

1
    You can use while loop for your purpose 

    <tr>
        <td>getEval</td>
        <td>index = 1;</td>
        <td></td>
    </tr>
    <tr>
        <td>while</td>
        <td>index &lt; 10;</td>
        <td></td>
    </tr>
    <tr>
        <td>storeEval</td>
        <td>index</td>
        <td>value</td>
    </tr>
    <tr>
        <td>echo</td>
        <td>survey ${value}</td>
        <td></td>
    </tr>
    <tr>
        <td>getEval</td>
        <td>index++;</td>
        <td></td>
    </tr>
    <tr>
        <td>endWhile</td>
        <td></td>
        <td></td>
    </tr>


    in the name text box field you give the value has survey ${value},
    now you can create any number of form with unique name by 
    using this while loop put your form inside this while loop.

    Try it

    Thank you.


<tr>
    <td>open</td>
    <td>/SurveyHome.aspx</td>
    <td></td>
</tr>
<tr>
    <td>getEval</td>
    <td>index = 1;</td>
    <td></td>
</tr>
<tr>
    <td>while</td>
    <td>index &lt; 100;</td>
    <td></td>
</tr>
<tr>
    <td>storeEval</td>
    <td>index</td>
    <td>value</td>
</tr>
<tr>
    <td>echo</td>
    <td>survey ${value}</td>
    <td></td>
</tr>
<tr>
    <td>clickAndWait</td>
    <td>id=ctl00_ContentPlaceHolder1_gvSurvey_ctl02</td>
    <td></td>
</tr>
<tr>
    <td>type</td>
    <td>id=ctl00_ContentPlaceHolder1_txtsurname</td>
    <td>survey ${value}</td>
</tr>
<tr>
    <td>click</td>
    <td>id=ctl00_ContentPlaceHolder1_btncopyok</td>
    <td></td>
</tr>
<tr>
    <td>getEval</td>
    <td>index++;</td>
    <td></td>
</tr>
<tr>
    <td>endWhile</td>
    <td></td>
    <td></td>
</tr>


try it.

thank you
于 2013-03-12T04:20:17.200 回答