0

ZATS DesktopAgent.query not working with id's

asked 2013-01-31 01:17:45 +0800

guto gravatar image guto
0

Hi, I'm starting with ZATS, but having a problem with DesktopAgent.query. If I use it with tags (label, textbox, etc.), it works ok. If I try to use it with id's (#customerName, etc.), it always returns null. Any hints?

Thanks in advance!

delete flag offensive retag edit

Comments

Please post test case code and testing page code

ashishd ( 2013-02-01 01:27:32 +0800 )edit

3 Answers

Sort by ยป oldest newest most voted
0

answered 2013-04-11 14:27:34 +0800

sprinz gravatar image sprinz
11 1

Hi guto,

have you found any solution for this? I'm having the same problem...

This works fine:

ComponentAgent usernameInput = desktop.query("textbox");

whereas this:

ComponentAgent usernameInput = desktop.query("#username");

returns "null" every time.

Test case:

    public class LoginMimicTest
   extends AbstractBaseTestCase
{
   public void setUp()
      throws Exception
   {
      super.setUp();
      //set secureTransfer into test mode
      setTestModeAndDummySCContext();
      //initialise the application path
      Zats.init("/");

   }


   public void testLogin()
   {
      //create client to connect to the zul-file
      DesktopAgent desktop = Zats.newClient().connect("/LoginContent.zul");
      //get the username input field
      ComponentAgent usernameInput = desktop.query("#username");
      assertNotNull(usernameInput); //and check if its not null
   }


   public void tearDown()
      throws Exception
   {
      super.tearDown();
      Zats.cleanup();
      Zats.end();
   }
}

Test-Page:

<zk xmlns:h="native" xmlns:zk="http://www.zkoss.org/2005/zk">
   <script type="text/javascript" src="/javascript/input.min.js" />
   <script>
         <![CDATA[ window.setTimeout("overrideInput();", 500); ]]>
   </script>
    <window width="100%" height="100%" border="none" id="loginWindow"
        onCreate="loginWindow.onCreate();" sclass="login-window"
        use="[...]">

        <!-- Timer used for keeping up session timeout (PE-1654) -->
        <timer repeats="true" running="true" delay="1800000"
            apply="[...]" />
        <h:div class="login-content">
           <h:div class="login-image-div">
               <image src="${dd:getImagePath('[...]')}" sclass="[...]"/>
               <h:div class="login-mask">
                <h:div class="login-mask-inner">
                    <h:div class="login-mask-row">
                        <h:span
                            class="login-label login-label-username">
                            ${c:l('login.username')}
                        </h:span>
                        <textbox width="225px"
                            value="${loginWindow.developmentLogin}" id="username"
                            tabindex="1" focus="true" onOK="password.focus()" />
                    </h:div>

.... ....

(I left a few things out, see [...] ).

link publish delete flag offensive edit
0

answered 2013-08-28 10:48:50 +0800

daquan198163 gravatar image daquan198163
9 1

I have the same problem with zats-1.1.0

link publish delete flag offensive edit
0

answered 2013-08-28 11:09:56 +0800

daquan198163 gravatar image daquan198163
9 1

I got it: You must query one level by one level.

For your code above,you must do like this: desktop.query("#loginWindow").query("#username")

link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
3 followers

RSS

Stats

Asked: 2013-01-31 01:17:45 +0800

Seen: 52 times

Last updated: Aug 28 '13

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More