View Full Version : Reading text field values generated by extJS4

1 Jun 2012, 12:41 PM
I am using ExtJS4 to develop my UI.

I am using read only form and loading it in the controller using


Form fields are defined as

fieldLabel:'Array Id',
fieldLabel:'Array Name',

values : [ id:10, name: 'testing']

Now the issue is I want to read the id (value: 10) and name (value: testing) values form generated HTML.

The generated HTML code is:
<form id = 'arraydevicewindowid'>

<input type="text" autocomplete="off" class="x-form-field x-form-text" size="20" name="${array.arrayName}" id="ext-gen1314" readonly="" aria-readonly="true" aria-invalid="false" placeholder="--NA--" role="textbox" aria-describedby="textfield-1260-errorEl" aria-required="false" data-errorqtip="" style="width: 281px; height: 23px;">


I tried to use the following xpath to select value from a textfield component generated by Extjs:

but it is returning null.

The values don't exist in HTML form but is there any way I can read the values by setting some properties inside form.

Thanks and Regards,

Tim Toady
1 Jun 2012, 12:57 PM
Why do you want to read their values from html when you can just do popup.down('form').getValues()?

1 Jun 2012, 1:17 PM
I want to read those values on Client Side for testing purpose

Tim Toady
1 Jun 2012, 1:29 PM
Client side? Your JS will be client side. Can you expound?

1 Jun 2012, 1:33 PM
I am using selenium to test my UI screens. To read values in selenium i am using xpaths. As values are not appearing on HTML my tests are getting failed.

1 Jun 2012, 1:51 PM
I thought Selenium required the id of the component for it to work correctly?


1 Jun 2012, 1:58 PM
It's not the case always. As extJS4 randomly generating ids for components we are using xpaths, instead to select components. Even selection through ids is going to use xpaths internally.