How to use ext-gen id created by EXTJS in Selenium?

While testing web application automation, I get dynamically generated ext-gen identifiers. I tried using xpath, but test cases fail. I went through different sites, but did not find luck. Can someone help me?

Thank you Srinivas Marti

+4
source share
3 answers

For automated testing, auto-generated ExtJS ID files are best avoided. You can assign your own static identifiers to components, but now you basically clog your code with global variables, and are also not good. Using some IDs can be a useful compromise, but you do not want to assign an identifier to each small button.

For ExtJS 4, I suggest using ComponentQuery :

Ext.ComponentQuery.query("panel[title='Orders'] button[text='Save']") 
+1
source

I have been able to automate EXTJS sites and automatically generated identifiers, although I do not recommend this. (since identifiers are automatically generated if new elements are added to the page, all of your locators are potentially invalid.)

I would recommend pin-pointing the exact element, not the full path

 //*[@id="ext-js123"] 
0
source

It’s best to use Selenium to set unique identifiers in your code.

Since there is no configuration button, you need to attach an identifier for the buttons after creating the button. In ExtJS 3, we used the ID for the buttons:

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

Unfortunately, in ExtJS 4 this no longer works, so I'm looking for a new solution .; -)

0
source

All Articles