Take the 2-minute tour ×

While test automating a web application, I get dynamically generated ext-gen IDs. I tried using xpath but the test cases are failing. I went through different websites but did not find any luck. Can somebody help me?

Thank you, Srinivas Marthi

share|improve this question
You need to supply the page HTML and tell us what you are trying to do. –  Ardesco May 23 '11 at 10:17
Wouldn't you want to use xpath during testing automation, rather than id? Then you will never have an issue. –  MacGyver Sep 8 at 21:05

3 Answers 3

For automated testing, the auto-generated ID-s of ExtJS are best avoided altogether. You can assign your own static ID-s to components, but now you are basically littering your code with global variables, not good either. Using some ID-s might be a helpful compromise, but you don't want to assign an ID to every single little button.

For ExtJS 4 I suggest using the ComponentQuery:

Ext.ComponentQuery.query("panel[title='Orders'] button[text='Save']")
share|improve this answer

I've been successful with automating EXTJS sites and auto-generated ids, though I do not recommend it. (because the ids are autogenerated, if new elements are added to the page, all your locators are potentially invalid.)

I'd recommend pin-pointing the precise item, instead of a full path

share|improve this answer

The best thing using Selenium is to set unique IDs in the Code.

As there is no config buttonId you have to attach the ID for buttons after creation of the button. In ExtJS 3 we used to set the ID for buttons:

dlg.getDialog().getEl().select('button').each(function(el) {
    el.dom.id = 'confirm-' + el.dom.innerHTML;

Unfortunatly this does not work anymore in ExtJS 4, so I am looking for a new solution also. ;-)

share|improve this answer

Your Answer


