How to do with the elementID changing repeatedly in selenium?

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?

Answers


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.


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.


Need Your Help

Newly created Azure Web App with Overview and Activity Log not found?

azure cloud azure-web-sites azure-web-app-service

I created a brand new web app on Azure. However, on navigating to the web app's page, the blades (panels) showcasing the service's overview and activity log (titled "Overview" and "Activity Log"

Powershell Script against outlook mail box is selecting old data

c# email powershell outlook

I am into this project wherein emails pushed into a folder has to be cross checked whether it arrives.