rycekrispies
rycekrispies

Reputation: 117

Test case will only work for one loop

My code does what i want for the first iteration but then when it gets to the "id=username" line it crashes with the errors: [error] modifyWindow: Window was closed! [error] Current window or frame is closed!

I dont understand becuase it works right off the bat for the first iteration and there isnt a frame on this page.

<tr>
    <td>open</td>
    <td>/workforce/Desktop.do</td>
    <td></td>
</tr>
<tr>
    <td>readCSV</td>
    <td>file://D:/Users/user/Desktop/CAON00015.csv</td>
    <td></td>
</tr>
<tr>
    <td>store</td>
    <td>2</td>
    <td>x</td>
</tr>
<tr>
    <td>while</td>
    <td>(${x}&lt;1077)</td>
    <td></td>
</tr>
<tr>
    <td>storeCellValue</td>
    <td>id</td>
    <td>${x}, 1</td>
</tr>
<tr>
    <td>echo</td>
    <td>${id}</td>
    <td></td>
</tr>
<tr>
    <td>type</td>
    <td>id=username</td>
    <td>${id}</td>
</tr>
<tr>
    <td>type</td>
    <td>id=password</td>
    <td>asda</td>
</tr>
<tr>
    <td>clickAndWait</td>
    <td>name=Submit</td>
    <td></td>
</tr>
<tr>
    <td>type</td>
    <td>id=username</td>
    <td>${id}</td>
</tr>
<tr>
    <td>type</td>
    <td>id=password</td>
    <td>sdada</td>
</tr>
<tr>
    <td>clickAndWait</td>
    <td>name=Submit</td>
    <td></td>
</tr>
<tr>
    <td>type</td>
    <td>id=username</td>
    <td>${id}</td>
</tr>
<tr>
    <td>type</td>
    <td>id=password</td>
    <td>aaaaaaaa</td>
</tr>
<tr>
    <td>clickAndWait</td>
    <td>name=Submit</td>
    <td></td>
</tr>
<tr>
    <td>type</td>
    <td>id=username</td>
    <td>${id}</td>
</tr>
<tr>
    <td>type</td>
    <td>id=password</td>
    <td>asda</td>
</tr>
<tr>
    <td>clickAndWait</td>
    <td>name=Submit</td>
    <td></td>
</tr>
<tr>
    <td>type</td>
    <td>id=username</td>
    <td>${id}</td>
</tr>
<tr>
    <td>type</td>
    <td>id=password</td>
    <td>aaaaaaaaa</td>
</tr>
<tr>
    <td>clickAndWait</td>
    <td>name=Submit</td>
    <td></td>
</tr>
<tr>
    <td>type</td>
    <td>id=username</td>
    <td>SuperUser</td>
</tr>
<tr>
    <td>type</td>
    <td>id=password</td>
    <td>Password1</td>
</tr>
<tr>
    <td>clickAndWait</td>
    <td>name=Submit</td>
    <td></td>
</tr>
<tr>
    <td>selectFrame</td>
    <td>EntryFrame</td>
    <td></td>
</tr>
<tr>
    <td>clickAndWait</td>
    <td>id=ext-gen80</td>
    <td></td>
</tr>
<tr>
    <td>selectWindow</td>
    <td>name=mainFrame</td>
    <td></td>
</tr>
<tr>
    <td>type</td>
    <td>id=ext-comp-1021</td>
    <td>${id}</td>
</tr>
<tr>
    <td>click</td>
    <td>id=ext-gen21</td>
    <td></td>
</tr>
<tr>
    <td>click</td>
    <td>css=button.resetPasswordButton</td>
    <td></td>
</tr>
<tr>
    <td>click</td>
    <td>//table[@id='ext-comp-1038']/tbody/tr[2]/td[2]/em</td>
    <td></td>
</tr>
<tr>
    <td>storeEval</td>
    <td>storedVars['x'] = ${x}+1</td>
    <td></td>
</tr>
<tr>
    <td>open</td>
    <td>/workforce/Desktop.do</td>
    <td></td>
</tr>
<tr>
    <td>endWhile</td>
    <td></td>
    <td></td>
</tr>

Upvotes: 0

Views: 54

Answers (1)

DMart
DMart

Reputation: 2461

Try adding a selectWindow as first step in your loop.

I think selenium is getting confused because you select the mainFrame but then it's no longer available.

<tr>
    <td>selectWindow</td>
    <td>name=mainFrame</td>
    <td></td>
</tr>

If that doesn't work, I'd look into why you need this selectWindow in your script in first place.

note I'm not a big fan of using these loopings within selenium IDE tests. If you truly need this functionality you should be thinking of moving out of the IDE & into webdriver.

Upvotes: 1

Related Questions