[Webtest] Re: About setinputfield

Marc Guillemot webtest@lists.canoo.com
Wed, 19 May 2004 09:58:57 +0200


Hi,

as the different input fields can't be differentiate, I guess that there is currently no possibility to set them. You 
could add an id to each input text field in the html code your generate and improve the setinputfield task to look at 
the id to set the right field.
But as previously said, I'm quite sure that you will come into problems with this page because the browser can send you 
values with same name in the order it wants.

Marc.

sunshuli wrote:
> Hi,
>  
> Below is html code segment:
> 
>  <tr class="HL">
>            ......
>             <td  >1 </td>
>             <td  >
>               <div align="center">
>                 <input type="text" name="pocCd" size="5" maxlength="5" 
> Value="CNDLC">
> 
>               </div>
>             </td>
>            ......
>   <tr class="HL">
>              ......
>             <td  >2 </td>
>             <td  >
>               <div align="center">
>                 <input type="text" name="pocCd" size="5" maxlength="5" 
> Value="USSEA">
> 
>               </div>
>             </td>
>             <td  >
>           ......
>  
>    <tr class="HL">
>              ......
>             <td  >3 </td>
>             <td  >
>               <div align="center">
>                 <input type="text" name="pocCd" size="5" maxlength="5" 
> Value="SGSIN">
> 
>               </div>
>             </td>
>             <td  >
>      .......
>      <tr class="HL">
>              ......
>             <td  >4 </td>
>             <td  >
>               <div align="center">
>                 <input type="text" name="pocCd" size="5" maxlength="5" 
> Value="">
> 
>               </div>
>             </td>
>       .......
>         <tr class="HL">
>             ......
>             <td  >5</td>
>             <td  >
>               <div align="center">
>                 <input type="text" name="pocCd" size="5" maxlength="5" 
> Value="">
> </div>
>             </td>
>         .......     
>           <tr class="HL">
>              ......
>             <td  >6 </td>
>             <td  >
>               <div align="center">
>                 <input type="text" name="pocCd" size="5" maxlength="5" 
> Value="">
> 
>               </div>
>             </td>
>        .......     
>           <tr class="HL">
>             ......
>             <td  >7 </td>
>             <td  >
>               <div align="center">
>                 <input type="text" name="pocCd" size="5" maxlength="5" 
> Value="">
> 
>               </div>
>             </td>
>          ........
>          
> There is only 1 name "pocCd" defined.
> 
> Thanks a lot.
> ----- Original Message -----
> From: "Marc Guillemot" <mguillemot@yahoo.fr <mailto:mguillemot@yahoo.fr>>
> To: <webtest@lists.canoo.com <mailto:webtest@lists.canoo.com>>
> Sent: Tuesday, May 18, 2004 9:53 PM
> Subject: [Webtest] Re: About setinputfield
> 
>  > This is NOT html code but jsp or something else!!!
>  >
>  > Marc.
>  >
>  > sunshuli wrote:
>  > > Hi Marc,
>  > > 
>  > > HTML code:
>  > > 
>  > >  for(int i = 0; i < 3; ++i) { %>
>  > >           <tr CLASS="HL">
>  > >             <td  > <input type="checkbox" name="selected" value="<%= i
>  > > %>"></td>
>  > >             <td><%= i+1 %> </td>
>  > >             <td>
>  > >             <input type="text" name="pocCd" size="5" maxlength="5"
>  > > Value="<%= tmpPocCd[i]==null ? "" : tmpPocCd[i] %>">
>  > >             </td>
>  > > <% }
>  > > 
>  > > There is only 1 parameter name "pocCd" defined in html in the for 
> loop.
>  > > But we have 3 values of port code that need to be inputted in this
>  > > field. And in Canoo, we need the different name of port code. How 
> can we
>  > > realize this in canoo script?
>  > > 
>  > > thanks a lot.
>  > > 
>  > > ----- Original Message -----
>  > > From: "Marc Guillemot" <mguillemot@yahoo.fr 
> <mailto:mguillemot@yahoo.fr> <mailto:mguillemot@yahoo.fr>>
>  > > To: <webtest@lists.canoo.com <mailto:webtest@lists.canoo.com> 
> <mailto:webtest@lists.canoo.com>>
>  > > Sent: Tuesday, May 18, 2004 5:22 PM
>  > > Subject: Re: [Webtest] Re: About setinputfield
>  > >
>  > >  > Hi sunshuli,
>  > >  >
>  > >  > I'm not interested at all in your jsp, neither I am in a screen 
> copy.
>  > > What is of interest is the generated html code
>  > >  > received by your browser not how it is graphically rendered. And 
> for
>  > > simplicity, only the few significative lines.
>  > >  >
>  > >  > Marc.
>  > >  >
>  > >  > sunshuli wrote:
>  > >  > > Hi,
>  > >  > >
>  > >  > > Attached is the source code (CreateSvcrt.jsp), due to the message
>  > > capaticy
>  > >  > > is limited, i will send you the result with running the jsp
>  > >  > > (CreateSvctr.doc) later.
>  > >  > >
>  > >  > > thanks a lot.
>  > >  > > sunshuli
>  > >  > >
>  > >  > > ----- Original Message -----
>  > >  > > From: "Marc Guillemot" <mguillemot@yahoo.fr 
> <mailto:mguillemot@yahoo.fr>
>  > > <mailto:mguillemot@yahoo.fr>>
>  > >  > > To: <webtest@lists.canoo.com <mailto:webtest@lists.canoo.com> 
> <mailto:webtest@lists.canoo.com>>
>  > >  > > Sent: Tuesday, May 18, 2004 4:45 PM
>  > >  > > Subject: [Webtest] Re: About setinputfield
>  > >  > >
>  > >  > >
>  > >  > >
>  > >  > >>Hi,
>  > >  > >>
>  > >  > >>can you please show the html code (ie what your browser receives)
>  > > and not
>  > >  > >
>  > >  > > the source of the "script" that generates it.
>  > >  > >
>  > >  > >>How do you imagine which field should be set in each 
> iteration? You
>  > > can't
>  > >  > >
>  > >  > > get any correspondance on the server side
>  > >  > >
>  > >  > >>between your checkboxes and your text fields.
>  > >  > >>
>  > >  > >>Marc.
>  > >  > >>
>  > >  > >>
>  > >  > >>sunshuli wrote:
>  > >  > >>
>  > >  > >>>  Hi, All
>  > >  > >>>
>  > >  > >>>  There is a problem about setinputfield need your help:
>  > >  > >>>
>  > >  > >>>  When I do test with <Setinputfield>,I need to input many 
> values in
>  > >  > >
>  > >  > > some
>  > >  > >
>  > >  > >>>text fields,For these text fields in different lines base on loop
>  > >  > >
>  > >  > > method,and
>  > >  > >
>  > >  > >>>there is a same name for these fields in html.
>  > >  > >>>
>  > >  > >>>  I need to give multi different values into these same name
>  > > textfileds
>  > >  > >
>  > >  > > in
>  > >  > >
>  > >  > >>>loop method.
>  > >  > >>>  But, i can't get expect result.( We hope we can get the result
>  > > ,A,B,C
>  > >  > >
>  > >  > > not
>  > >  > >
>  > >  > >>>porCD.value${i} in textfield)
>  > >  > >>>  We got :
>  > >  > >>>
>  > >  > >>>  Porcode:
>  > >  > >>>       [echo] pocCD.value
>  > >  > >>>       [echo]
>  > >  > >>>
>  > >  > >>>  all:
>  > >  > >>>       [echo] pocCD.value
>  > >  > >>>       [echo]
>  > >  > >>>       [echo] pocCD.value.${i}
>  > >  > >>>       [echo]
>  > >  > >>>
>  > >  > >>>  BUILD SUCCESSFUL
>  > >  > >>>
>  > >  > >>>    Could you help me what's matter with  my test script?
>  > >  > >>>
>  > >  > >>>  Bellow is source of html, please as reference
>  > >  > >>>
>  > >  > >>>  for(int i = 0; i < tmpPocCd.length; ++i) { %>
>  > >  > >>>   <tr CLASS="HL">
>  > >  > >>>   <td  > <input type="checkbox" name="selected" value="<%= i
>  > > %>"></td>
>  > >  > >>>   <td><%= i+1 %> </td>
>  > >  > >>>   <td>
>  > >  > >>>
>  > >  > >>>  <input type="text" name="pocCd" size="5" maxlength="5" 
> Value="<%=
>  > >  > >>>tmpPocCd[i]==null ?  : tmpPocCd[i] %>">
>  > >  > >>>   </td>
>  > >  > >>>
>  > >  > >>>  Bellow is test script, please as reference.
>  > >  > >>>
>  > >  > >>>             ....
>  > >  > >>>
>  > >  > >>>  <!--Repeat-->
>  > >  > >>>
>  > >  > >>>
>  > >  > >>>
>  > >  > >>>                   <repeat count="3" countername="row">
>  > >  > >>>
>  > >  > >>>
>  > >  > >>>
>  > >  > >>>                     <setinputfield
>  > >  > >>>
>  > >  > >>>                          stepid="set Port Code in Select Update
>  > > Sailing
>  > >  > >>>Schedule Detail page"
>  > >  > >>>
>  > >  > >>>                          name="pocCd"
>  > >  > >>>
>  > >  > >>>                          value="${pocCD.value}"/>
>  > >  > >>>
>  > >  > >>>                  </repeat>
>  > >  > >>>
>  > >  > >>>             ....
>  > >  > >>>
>  > >  > >>>   <target name = "Porcode" >
>  > >  > >>>
>  > >  > >>>
>  > >  > >>>
>  > >  > >>>            <loadproperties
>  > >  > >>>srcFile="${webtest.home}/canoo/Porcode1.properties"/>
>  > >  > >>>
>  > >  > >>>                  <echo>Porcode pocCD.value.${i}
>  > >  > >>>
>  > >  > >>>          </echo>
>  > >  > >>>
>  > >  > >>>            <antcall target="porcodefile1" >
>  > >  > >>>
>  > >  > >>>            </antcall>
>  > >  > >>>
>  > >  > >>>          </target>
>  > >  > >>>
>  > >  > >>>         <target name="porcodefile1">
>  > >  > >>>
>  > >  > >>>              <propertyfile
>  > >  > >>>file="${webtest.home}/canoo/Porcode1.properties">
>  > >  > >>>
>  > >  > >>>                  <entry  key="i" type="int" operation="+" 
> value="1"/>
>  > >  > >>>
>  > >  > >>>          </propertyfile>
>  > >  > >>>
>  > >  > >>>
>  > >  > >>>
>  > >  > >>>          <echo>procodefile1 pocCD.value.${i}
>  > >  > >>>
>  > >  > >>>          </echo>
>  > >  > >>>
>  > >  > >>>            <antcall target= "getvalue">
>  > >  > >>>
>  > >  > >>>                  </antcall>
>  > >  > >>>
>  > >  > >>>     </target>
>  > >  > >>>
>  > >  > >>>
>  > >  > >>>
>  > >  > >>>             <target name="getvalue">
>  > >  > >>>
>  > >  > >>>                    <loadproperties
>  > >  > >>>srcFile="${webtest.home}/canoo/Porcode1.properties"/>
>  > >  > >>>
>  > >  > >>>                    <echo>getvalue pocCD.value.${i}
>  > >  > >>>
>  > >  > >>>                    </echo>
>  > >  > >>>
>  > >  > >>>                   <antcall target="all">
>  > >  > >>>
>  > >  > >>>                   </antcall>
>  > >  > >>>
>  > >  > >>>             </target>
>  > >  > >>>
>  > >  > >>>
>  > >  > >>>
>  > >  > >>>      Bellow is my Porcode.properties:
>  > >  > >>>
>  > >  > >>>  i=1
>  > >  > >>>
>  > >  > >>>  pocCD.value.3=C
>  > >  > >>>
>  > >  > >>>  pocCD.value.2=B
>  > >  > >>>
>  > >  > >>>  pocCD.value.1=A
>  > >  > >>>
>  > >  > >>>
>  > >  > >>>
>  > >  > >>>     Anyone can help?
>  > >  > >>>
>  > >  > >>>   Thanks a lot.
>  > >  > >>
>  > >  > >>
>  > >  > >>_______________________________________________
>  > >  > >>WebTest mailing list
>  > >  > >>WebTest@lists.canoo.com <mailto:WebTest@lists.canoo.com> 
> <mailto:WebTest@lists.canoo.com>
>  > >  > >>http://lists.canoo.com/mailman/listinfo/webtest
>  > >  >
>  > >  >
>  > >  > _______________________________________________
>  > >  > WebTest mailing list
>  > >  > WebTest@lists.canoo.com <mailto:WebTest@lists.canoo.com> 
> <mailto:WebTest@lists.canoo.com>
>  > >  > http://lists.canoo.com/mailman/listinfo/webtest
>  >
>  >
>  > _______________________________________________
>  > WebTest mailing list
>  > WebTest@lists.canoo.com <mailto:WebTest@lists.canoo.com>
>  > http://lists.canoo.com/mailman/listinfo/webtest