如何在Selenium IDE中使用For循环来遍历页面

时间:2015-08-06 12:14:58

标签: php selenium web-testing headless-browser

我想看到我的网页从第1页到第200页自动更改,我尝试使用php和javascript,但没有使用for循环。有没有办法在页面中使用for循环?

    <tr> 
        <td>clickAndWait</td>
        <td>link=2</td>
        <td></td>
    </tr>
    <tr>
        <td>clickAndWait</td>
        <td>link=3</td>
        <td></td>
    </tr>
    <tr>
        <td>clickAndWait</td>
        <td>link=4</td>
        <td></td>
    </tr>
    <tr>
        <td>clickAndWait</td>
        <td>link=5</td>
        <td></td>
    </tr>
<tr>
    <td>getEval</td>
    <td>link = 6;</td>
    <td></td>
</tr>
<tr>
    <td>while</td>
    <td>link &lt; 10;</td>
    <td></td>
</tr>
<tr>
    <td>storeEval</td>
    <td>link</td>
    <td>value</td>
</tr>
<tr>
    <td>echo</td>
    <td>link = ${value}</td>
    <td></td>
</tr>
<tr>
    <td>getEval</td>
    <td>link++;</td>
    <td></td>
</tr>
<tr>
    <td>endWhile</td>
    <td></td>
    <td></td>
</tr>

我希望链接在1到100的for循环中。我感谢任何帮助我的人。到目前为止,我试图回应页码,但有没有办法循环浏览页面?

到目前为止,这是我得到的输出:

[info] Executing: |clickAndWait | link=2 | |
[info] Executing: |clickAndWait | link=3 | |
[info] Executing: |clickAndWait | link=4 | |
[info] Executing: |clickAndWait | link=5 | |
[info] Executing: |clickAndWait | link=6 | |
[info] Executing: |getEval | link = 6; | |
[info] script is: link = 6;
[info] Executing: |while | link < 10; | |
[info] Executing: |storeEval | link | value |
[info] script is: link
[info] Executing: |echo | link = ${value} | |
[info] echo: link = 6
[info] Executing: |echo | {$Value} | |
[info] echo: {$Value}
[info] Executing: |getEval | link++; | |
[info] script is: link++;
[info] Executing: |endWhile | | |
[info] Executing: |while | link < 10; | |
[info] Executing: |storeEval | link | value |
[info] script is: link
[info] Executing: |echo | link = ${value} | |
[info] echo: link = 7
[info] Executing: |echo | {$Value} | | 

0 个答案:

没有答案