1. #1
    Sencha User
    Join Date
    Feb 2012
    Posts
    26
    Vote Rating
    0
    suryanarendra is on a distinguished road

      0  

    Default Unanswered: Reading text field values generated by extJS4

    Unanswered: Reading text field values generated by extJS4


    I am using ExtJS4 to develop my UI.

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

    "popup.down('form').loadRecord(record);"


    Form fields are defined as

    items:[
    {
    xtype:'textfield',
    fieldLabel:'Array Id',
    name:'id'
    },
    {
    xtype:'textfield',
    fieldLabel:'Array Name',
    name:'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;">

    </form>

    I tried to use the following xpath to select value from a textfield component generated by Extjs:
    (//div[@id='arraydevicewindowid']//input)[1]//@value

    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,
    Nari

  2. #2
    Sencha User Tim Toady's Avatar
    Join Date
    Feb 2010
    Location
    Pennsylvania
    Posts
    536
    Answers
    61
    Vote Rating
    70
    Tim Toady is a jewel in the rough Tim Toady is a jewel in the rough Tim Toady is a jewel in the rough Tim Toady is a jewel in the rough

      0  

    Default


    Why do you want to read their values from html when you can just do popup.down('form').getValues()?

  3. #3
    Sencha User
    Join Date
    Feb 2012
    Posts
    26
    Vote Rating
    0
    suryanarendra is on a distinguished road

      0  

    Default


    I want to read those values on Client Side for testing purpose

  4. #4
    Sencha User Tim Toady's Avatar
    Join Date
    Feb 2010
    Location
    Pennsylvania
    Posts
    536
    Answers
    61
    Vote Rating
    70
    Tim Toady is a jewel in the rough Tim Toady is a jewel in the rough Tim Toady is a jewel in the rough Tim Toady is a jewel in the rough

      0  

    Default


    Client side? Your JS will be client side. Can you expound?

  5. #5
    Sencha User
    Join Date
    Feb 2012
    Posts
    26
    Vote Rating
    0
    suryanarendra is on a distinguished road

      0  

    Default


    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.

  6. #6
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    8,866
    Answers
    652
    Vote Rating
    438
    scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future

      0  

    Default


    I thought Selenium required the id of the component for it to work correctly?

    Scott.

  7. #7
    Sencha User
    Join Date
    Feb 2012
    Posts
    26
    Vote Rating
    0
    suryanarendra is on a distinguished road

      0  

    Default


    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.

Thread Participants: 2