How to use loops in Selenium IDE

£可爱£侵袭症+ 提交于 2020-01-17 03:55:07

问题


Is for loop present in Selenium IDE? if yes, How can I use it in Selenium IDE?

Thanks, Nit


回答1:


We can use while loop and goto function in Selenium IDE.

For that we must install the addon flow control. Add from the following link:

Selenium IDE: Flow Control

After installing you will get the commands while and gotoif in Selenium IDE

1) Example for while loop

<tr>
    <td>getEval</td>
    <td>index = 0;</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>${value}</td>
    <td></td>
</tr>
<tr>
    <td>getEval</td>
    <td>index++;</td>
    <td></td>
</tr>
<tr>
    <td>endWhile</td>
    <td></td>
    <td></td>
</tr>

2) Example for gotoif

store  |  10  |  x

gotoIf | storedVars['x'] > -2 && storedVars['x'] <50  |  true

getEval| alert("Condition Fails")

gotolabel | finish

label  |  true

getEval  | alert("Condition Pass")

label  | finish


try this Thank you..



回答2:


Yes, we can have looping in IDE
You can refer below URL for looping in IDE

Selenium IDE: How to Pass Variables
How to write gotoif (i > -2 && i < 100) in Selenium IDE?
http://radical-qa.blogspot.in/2012/02/selenium-ide_09.html



来源:https://stackoverflow.com/questions/14585392/how-to-use-loops-in-selenium-ide

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