2
votes

I am using selenium IDE 1.9.0 to record a test. Please advise me what I didn't wrong and how to fix the problem.

here are the steps that i am taking to record the test. 1.I logged into the site with username and password 2.I navigated to search member page to type in the member's name, click on the name link the system lead me to the member profile page.

The script stopped at this line:

ClickAndWait  id=cmp_admin

the first time I played script it runs without any error. The run the script on after 8 hours, it prompts me the following error:

[error] Element id=cmp_admin not found

I used the debug function to see what went wrong. Here are the messages displayed in the debug pane:

[debug] modifySeparateTestWindowToDetectPageLoads: already polling this window: selenium1365079281311 
[debug] getCurrentWindow newPageLoaded = false 
[error] Element id=cmp_admin not found
[debug] commandError 
[debug] testComplete: failed=true

Here is the html code generated by Selenium IDE

<tr>
    <td>open</td>
    <td>/</td>
    <td></td>
</tr>
<tr>
    <td>click</td>
    <td>id=nd_home</td>
    <td></td>
</tr>
<tr>
    <td>clickAndWait</td>
    <td>id=cmp_admin</td>
    <td></td>
</tr>
<tr>
    <td>click</td>
    <td>id=quicksearch_anchor</td>
    <td></td>
</tr>
<tr>
    <td>clickAndWait</td>
    <td>css=img[alt=&quot;Member&quot;]</td>
    <td></td>
</tr>
<tr>
    <td>type</td>
    <td>id=search_name</td>
    <td>suzy</td>
</tr>
<tr>
    <td>clickAndWait</td>
    <td>link=Balagia, Suzy</td>
    <td></td>
</tr>
</tbody></table>
</body>
</html>
2

2 Answers

3
votes

If you click on any button or link after clicking some time is taken to load page, if page is not load completely then selenium ide do not found ID or name of next element. To resolved such type of issue used Pause , waitfortext, clickandwait command

I make some changes in the code please run and let me know it work for you or not.

<tr>
    <td>open</td>
    <td>/</td>
    <td></td>
</tr>
<tr>
    <td>click</td>
    <td>id=nd_home</td>
    <td></td>
</tr>
 <tr>
    <td>pause</td>
    <td>1500</td>
    <td></td>
</tr>
<tr>
    <td>clickAndWait</td>
    <td>id=cmp_admin</td>
    <td></td>
</tr>
<tr>
    <td>click</td>
    <td>id=quicksearch_anchor</td>
    <td></td>
</tr>
<tr>
    <td>clickAndWait</td>
    <td>css=img[alt=&quot;Member&quot;]</td>
    <td></td>
</tr>
<tr>
    <td>type</td>
    <td>id=search_name</td>
    <td>suzy</td>
</tr>
<tr>
    <td>clickAndWait</td>
    <td>link=Balagia, Suzy</td>
    <td></td>
</tr>
</tbody></table>
</body>
</html>
1
votes

It could be a couple of things. First, is the element you're looking for (id=cmp_admin) on the page and still called cmp_admin? From your code, it looks like you have to click on id=nd_home, then a page loads that contains cmp_admin. If that's the case, most likely the page hasn't finished loading so the element isn't there yet. Try using a waitfor command between the click on nd_home like this:

click | id=nd_home |

waitForElementPresent | id=cmp_admin |

clickAndWait | id=cmp_admim |

You could also try a pause, waiting a couple of seconds, but I find waitfor commands to be less fragile, especially if you have lots of Ajax requests or elements that have to load.

Klendathu