Question

How to do with the Element ID changing repeatedly in selenium IDE ?

this comes when I click in the button and refresh the page and click it again !

<tr>
    <td>open</td>
    <td>/FEP/LoginHandlerServlet.htm</td>
    <td></td>
</tr>
<tr>
    <td>click</td>
    <td>id=a2uPu0</td>
    <td></td>
</tr>
<tr>
    <td>click</td>
    <td>id=tU9Pu0</td>
    <td></td>
</tr>
<tr>
    <td>click</td>
    <td>id=qXCPu0</td>
    <td></td>
</tr>

My web application develop with ZK ( Zkoss)!

any idea?

Was it helpful?

Solution

Try finding the element by xpath or by link text, not by ID.

by linktext:

driver.findElement(By.linkText("Link text")).click(); 

by xpath:

findElement(By.xpath("your xpath")).click();

I gouess in YOur situation linktext would be better.

OTHER TIPS

This is a common problem that I find with certain web frames (e.g. Wicket) where the HTML id changes each time the web page is rendered. If the development team is on board with automating your tests, then there is typically a way to make these ID's static, solving your problem. Otherwise, as mentioned previously you have to use some other identifying tag.

Here is a good website to get you started on all of the available options that you have at your disposal.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top