Results 1 to 4 of 4

Thread: Best way to reach gridcolumn header to click on it ?

  1. #1
    Sencha User
    Join Date
    Jul 2016
    Posts
    2

    Default Answered: Best way to reach gridcolumn header to click on it ?

    Hi everyone,

    So I'm testing an interface that displays a grid, I'd like to click on column headers to test the behavior.
    The thing is that with Ext, the grid headers are autogenerated from the "column" config of the grid object.

    I cannot use the event recorder because it locates the headers with their ID, but these are autogenerated by Ext and not always the same.

    So far I added an itemId parametter to each column declaration. Which allows me to locate each column individually like this :
    Code:
    var col = ST.find("component[itemId='barcodeColumn']", true);
    But then I'm getting lost, I've tried using
    Code:
    ST.element(html).click(5,5);
    following this doc : http://docs.sencha.com/sencha_test/a...l#method-click

    But I can't get it to work.
    So what is the best way to get to the grid headers indiviadually to click on them ?

    Is it possible click on a dom element with ST ? Like locate the element with its HTML and then trigger an action on this element ?

    Thanks.

  2. You can use
    Code:
    ST.component('gridcolumn[itemId=' + yourID +']').click();
    You can use XPATH, A-Path, CompositeQuery, ComponentQuery to locate element/object - look at http://docs.sencha.com/sencha_test/api/ST.Locator.html


    And it is possible to fire clicking on DOM element.

    My prefer way is via DOM Query - http://docs.sencha.com/sencha_test/a...ator_dom-query
    Code:
    ST.element('>> #myID').click()
    You can look at https://github.com/sencha/SenchaTest...l/email.js#L44 , where we use it - we found column by text (title), and then we work with it - click, assertions, etc.

    Feel free to contact me anytime.
    Vojtěch

  3. #2
    Sencha User
    Join Date
    Jul 2016
    Posts
    2

    Default

    More generally, is it possible to fire a click on a DOM element located with this kind of query selector :
    Code:
    "#somedivid"
    or
    Code:
    "div[id='somedivid']
    And by firing a click I mean emulate a user click, not just fire a 'onClick' or 'click' function.

  4. #3
    Sencha User
    Join Date
    Jun 2015
    Location
    Ostrava, Czech republic
    Posts
    52
    Answers
    10

    Default

    You can use
    Code:
    ST.component('gridcolumn[itemId=' + yourID +']').click();
    You can use XPATH, A-Path, CompositeQuery, ComponentQuery to locate element/object - look at http://docs.sencha.com/sencha_test/api/ST.Locator.html


    And it is possible to fire clicking on DOM element.

    My prefer way is via DOM Query - http://docs.sencha.com/sencha_test/a...ator_dom-query
    Code:
    ST.element('>> #myID').click()
    You can look at https://github.com/sencha/SenchaTest...l/email.js#L44 , where we use it - we found column by text (title), and then we work with it - click, assertions, etc.

    Feel free to contact me anytime.
    Vojtěch

  5. #4

    Default

    ID is dynamic, is there another way to do it?

Similar Threads

  1. [FIXED] gridcolumn constructor broken for grouped header columns
    By dmoore1 in forum Ext JS 6.x Bugs
    Replies: 2
    Last Post: 30 Jan 2016, 6:25 PM
  2. Replies: 5
    Last Post: 15 Oct 2015, 1:56 PM
  3. grid group header, gridcolumn click
    By nar in forum Ext: Discussion
    Replies: 2
    Last Post: 5 Sep 2011, 7:30 AM
  4. can't reach the IDs of my tree but I can reach the tree object.
    By dirtdevil in forum Sencha Ext JS Q&A
    Replies: 2
    Last Post: 7 Jun 2008, 8:23 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •