jeudi 12 novembre 2015

ZK-GUI Test: How to query gui-element by UuiD?

so, i'm using zats for gui testing and i would like to know if there is any way to query the ui-elements by UuiD in ZATS not by id that by dynamic elements doesn't exists. I've written IDGenerator for my dynamically generated gui elements (so now it sets UuiD all the elements). Now i need to query a certain element by UuiD. For example like this desktopAgent.query"listbox[uuid='listbox_104']" nothing happens.

So this is method returns a list of components by UuiD

public List<ComponentAgent> queryAllByRegex(DesktopAgent desktop, String component) {
    List<ComponentAgent> componentList = new ArrayList<ComponentAgent>();
    // getting the last counter value for the desktop
    String MAX = (String) desktop.getAttribute(IDGenerator.LAST_COMPONENT_ID); // ?
    int max =Integer.parseInt(MAX);     
    // generate the pattern Exmpl: "listbox_[0-9]"
    String pattern = component + "_";
    String counter = "";
    for (int idx = 0; idx < MAX.length(); idx++) {
        counter = counter + "[0-9]";
    }
    pattern = pattern + counter;

    // genetrate regular expressions
    Generex generex = new Generex(pattern);

    // Using Generex iterator to iterate the recently generated list of strings by regex pattern
    Iterator iterator = generex.iterator();

    for(int i=0; i<=max;i++){
        //removes extra nulls
        String comp = removeNulls(iterator.next());
        ComponentAgent agent = desktop.query(component+"[uuid='"+comp+"']");
        if (agent != null) {
            componentList.add(agent);
            log.info("found by id" + comp);
        }
    }
    return componentList;

}

Here i get null what ever i tried

ComponentAgent agent = desktop.query(component+"[uuid='"+comp+"']");

i'm really puzzled and i don't know if it at all possible to test my zk-gui with ZATS. THX

Aucun commentaire:

Enregistrer un commentaire