<tr>
<td>open</td>
<td>http://www.theshop.com</td>
<td></td>
</tr>
<tr>
<td>clickAndWait</td>
<td>css=img[alt="Theitem size 5"]</td>
<td></td>
</tr>
嗨,我如何设置一个if else循环。我希望它能看到这个项目是否可用,如果要移动到下一步,如果不是回到开始。或者它可以刷新直到项目出现,然后继续前进到下一步。我m only learning so apologies if i
没有多大意义。
答案 0 :(得分:0)
Selenese本身不支持条件语句(if-else等)或迭代(for,while等)。无需流量控制即可进行许多有用的测试。但是,对于动态内容的功能测试,可能涉及多个页面,通常需要编程逻辑。
当需要流量控制时,有三个选项:
- Run the script using Selenium-RC and a client library such as Java or PHP to utilize the programming language’s flow control features.
- Run a small JavaScript snippet from within the script using the storeEval command.
- Install the goto_sel_ide.js extension.