PDA

View Full Version : Elements Id's of Items in Combox



denizstij
7 May 2008, 9:09 AM
Hi,

We are using Selenium for testing our UI which is developed by ext-gwt(gxt). In selenium, each html elements must have a static id, in order to invoke a specific action on that element in a test case.

We are able to set a static unique id almost all widget in ext-qwt but combox. It seems combobox widget has several subcomponents and items in a combobox is rendered on internal panel (called "list" in combobox class) of which id is set internally. I would like to set id of this panel (and also "view" DataView object's id). But i am not able to do that. As in the attachment, these two elements get "my-41" (container) and "my-42" (view) dynamically.

Please note that, I am able to set the id of combobox (with setID(String) method) but not the id of these items and their internal container (list and view).

Briefly, i need to set element id of "list" (Container) and "view" (DataView) objects (in other words, item's id) as if in "initList" method Combobox class.

initList () {
...
list.setId("list_static_id");
view.setId("view_id");
...
}


Any idea ?

Thanks in advance

Deniz

deanoj
12 May 2008, 1:57 PM
Having never used GXT I can't be certain this will work.

However I had the same problem with ExtJS. You're correct about the combo having child components been the issue. What I did was extend the ComboBox to explicitly set an ID for the 'inner' dropdown....

Original:


this.innerList = this.list.createChild({cls:cls+'-inner'});

Modified:


this.innerList = this.list.createChild({cls:cls+'-inner', id: this.innerId});

Now i can use the 'innerId' config option when defining my customcombo, and selenium works fine.

Hope this helps.

Deano

darrellmeyer
12 May 2008, 3:07 PM
I added "id={id}" to the default template. If your model object has an id, it will be substituted. Change is in SVN.

janm
16 Apr 2010, 1:50 AM
Hi, I'm fairly new to extjs and trying to do selenium testing on comboboxes.
The proposed solution doesn't seem to work in extjs 3 (I'm assuming since the topic was started in 2008, the solution was proposed for extjs 2), unless I'm implementing it the wrong way.



var states = [
['AL', 'Alabama'],
['AK', 'Alaska'],
['AZ', 'Arizona'],
['AR', 'Arkansas']
];

var store = new Ext.data.SimpleStore({
fields: ['abbr', 'state'],
data : states
});

combo_ext = Ext.extend(Ext.form.ComboBox, {
constructor: function(config) {
Ext.apply(this, {
width: 200
});
combo_ext.superclass.constructor.apply(this, arguments);
this.innerList = this.list.createChild({cls:cls+'-inner', id: this.innerId});
}
});

Ext.reg('extendedcomboxtype', combo_ext);


Is there an alternative way to get the dropdown list's id via selenium or does it still need to be picked up on creation and then saved in the component itself?

Thanks
J