7 Replies Latest reply on Jun 5, 2008 5:57 PM by ssilvert

    click method doesn't working

    bngupta

      Hi Stan,

      i am using jsfsession.

      and the code in my aplication is ............................................


      <h:commandButton id="retrEmpBySidHidden" action="#{cloverEmployee.getEmployeeNames}" onclick="return validateSidOrLName();" image="/ibclover/cloverImages/buttons/button-retremployee.gif"/>
      ............................................................................................................
      and the code in test case is ..........

      client.click("myformID:retrEmpBySidHidden");
      .............................................................................................
      for which click method doesn't work
      could u please help me


      thanx
      Nara

        • 1. Re: click method doesn't working
          ssilvert

          How do you know it doesn't work? Are there errors? What is the result?

          Stan

          • 2. Re: click method doesn't working
            bngupta

            hi Stan,

            It's not giving any error,but control is not reaching till that line of code i.e., say client.click("retrEmpBySidHidden");



            Thanx
            Nara

            • 3. Re: click method doesn't working
              ssilvert

              I still don't understand what you mean. Control is not reaching what line of code?

              Please post the full test method and a larger snippet of your markup. Then fully explain what is happening (or not happening).

              Stan

              • 4. Re: click method doesn't working
                bngupta

                Hi Stan,

                In My Application i have a text box .which i have set by saying in my script
                as client.setValue("employeeSidOrLName","O023384"); after
                In my Page if we click on "retrEmpBySidHidden" button we are calling bean action method. i have written in my test script like this..........
                client.click("retrEmpBySidHidden"); i put some log statements in my bean action method... the logger statements are not printing anything...
                actually if i click the button it should go to bean method and retreive employee names as list...after clicking that button the list is coming empty...then i went into bean method, the controll is not coming to that....

                Thanx,
                Nara

                • 5. Re: click method doesn't working
                  ssilvert

                  Nara,

                  It's very hard to help you if you won't give me the information I ask for.

                  Again, please post the full test method and a larger snippet of your markup. I need to see the code and the markup in context.

                  Stan

                  • 6. Re: click method doesn't working
                    bngupta

                    Hi Stan,

                    sorry for inconvienence

                    my test script is .............................................................................

                    public class TestHome extends ServletTestCase
                    {

                    private JSFClientSession client;
                    private JSFServerSession server;

                    public static Test suite()
                    {
                    return new TestSuite(TestHome.class);
                    }
                    public void testInitialPage() throws IOException, SAXException
                    {

                    JSFSession jsfSession = new JSFSession("/clover/home/home.faces?sid=O023384&appId=1&appName=CLOVER&src=test",BrowserVersion.INTERNET_EXPLORER_6_0);
                    this.client = jsfSession.getJSFClientSession();
                    this.server = jsfSession.getJSFServerSession();
                    assertEquals("/clover/ValidateEquities.jsp", server.getCurrentViewID());
                    UIComponent prompt = server.findComponent("switchRoleId");
                    assertTrue(prompt.isRendered());
                    ........................
                    ........................
                    client.setValue("employeeSidOrLName","O023384");
                    try{
                    client.click("retrEmpBySidHidden");
                    } catch(Throwable e)
                    {
                    e.printStackTrace();
                    }
                    }
                    ............................................................................................................
                    JSP page code............................



                    <h:panelGrid columns="5" width="100%" columnClasses="collData,col2Data,col3Data,col4Data,col5Data">
                    <h:outputLabel value="Employee" styleClass="text_bold"/>

                    <h:selectOneRadio id="sidOrLName" value="#{cloverEmployee.sidOrLname}" layout="pageDirection" >
                    <f:selectItems value="#{cloverEmployee.radioSelectList}" />
                    </h:selectOneRadio>
                    <h:panelGroup>
                    <h:inputText id="employeeSidOrLName" value="#{cloverEmployee.employeeSidOrLname}" onkeydown="return checkEnterKey(event);" styleClass="text" onfocus="javascript:text_focusIn(this)" onblur="javascript:text_focusOut(this)"/>
                    </h:panelGroup>
                    <h:panelGroup>
                    <h:commandButton id="retrEmpBySidHidden" action="#{cloverEmployee.getEmployeeNames}" onclick="return validateSidOrLName();" image="/ibclover/cloverImages/buttons/button-retremployee.gif"/>
                    </h:panelGroup>

                    ...........................................................................................................


                    Thanx
                    Nara

                    • 7. Re: click method doesn't working
                      ssilvert

                      OK. That's better.

                      I suspect that there is something wrong with this part:

                      onclick="return validateSidOrLName();"


                      Can you remove that validation logic and see what happens?

                      Stan