[Webtest] How to use verifyelement and setinputfield when have duplicate elements
Shlomit Becker
webtest@lists.canoo.com
Wed, 14 Apr 2004 10:15:58 +0300
This is a multi-part message in MIME format.
------_=_NextPart_001_01C421F0.5587C985
Content-Type: text/plain;
charset="US-ASCII"
Content-Transfer-Encoding: quoted-printable
Question 1.=20
What do I do if I want use verifyelement, and there are 2 instances of
the same element on the page that have the same type and text.
For example, the html contains the following element twice, in 2
different forms: =20
<form name=3D"form1"...>
<input type=3D"text" name=3D"phrase">
</form>
<form name=3D"form2"...>
<input type=3D"text" name=3D"phrase">
</form>
If I use the following in my test:=20
<verifyelement
stepid=3D"Check for the phrase field"
type=3D"input"
text=3D"phrase"/>
I get the error "More than 1 element with type "input" and name "phrase"
found!". This error makes sense, the question is how to specify which
input element I am referring to? I see that you can use "regex", does
anyone know if using this can help with this problem, and if so can you
give me an example?
Question 2:
The next problem is if I want to use setinputfield to set this value,
such as:
<setinputfield=20
stepid=3D"set text to search for"=20
name=3D"phrase"=20
value=3D"credit"/>
Is there a way for me to specify which of the 2 instances of this
element I am setting?=20
Thanks, Shlomit
------_=_NextPart_001_01C421F0.5587C985
Content-Type: text/html;
charset="US-ASCII"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>Message</TITLE>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Dus-ascii">
<META content=3D"MSHTML 6.00.2800.1276" name=3DGENERATOR></HEAD>
<BODY>
<DIV><FONT size=3D1>
<P><SPAN class=3D317444306-14042004></SPAN><FONT face=3DArial><FONT =
size=3D2><SPAN=20
class=3D317444306-14042004>Question 1. </SPAN></FONT></FONT></P>
<P><FONT face=3DArial><FONT size=3D2><SPAN =
class=3D317444306-14042004></SPAN>W<SPAN=20
class=3D317444306-14042004>hat do I do if I want use=20
<STRONG>verifyelement</STRONG>, and there are 2 instances of the same =
element on=20
the page that have the same <STRONG>type</STRONG> and=20
<STRONG>text</STRONG>.</SPAN></FONT></FONT></P><FONT face=3DArial =
size=3D2><SPAN=20
class=3D317444306-14042004></SPAN></FONT></FONT></DIV>
<DIV><FONT size=3D1><FONT><SPAN class=3D317444306-14042004></SPAN>
<P><SPAN class=3D317444306-14042004></SPAN><FONT face=3DArial =
size=3D2>F<SPAN=20
class=3D317444306-14042004>or example, the html contains the=20
following element twice, in 2 different =
forms:</SPAN></FONT><FONT><SPAN=20
class=3D317444306-14042004><FONT face=3DArial size=3D2><SPAN=20
class=3D317444306-14042004> </SPAN></FONT></P>
<P><FONT face=3DArial size=3D2><SPAN =
class=3D317444306-14042004> =20
<form name=3D"form1"...></SPAN></FONT></P>
<P><FONT face=3DArial size=3D2><SPAN=20
class=3D317444306-14042004> =
<input=20
type=3D"text" name=3D"phrase"></SPAN></FONT></P>
<P><FONT face=3DArial size=3D2><SPAN =
class=3D317444306-14042004> =20
</form></SPAN></FONT></P><FONT face=3DArial size=3D2><SPAN=20
class=3D317444306-14042004>
<P><FONT face=3DArial size=3D2><SPAN =
class=3D317444306-14042004> =20
<form name=3D"form2"...></SPAN></FONT></P>
<P><FONT face=3DArial size=3D2><SPAN=20
class=3D317444306-14042004> =
<input=20
type=3D"text" name=3D"phrase"></SPAN></FONT></P>
<P><FONT face=3DArial size=3D2><SPAN =
class=3D317444306-14042004> =20
</form></SPAN></FONT></P></SPAN></FONT>
<P><FONT face=3DArial><FONT size=3D2><SPAN class=3D317444306-14042004>If =
I use the=20
following in my test: </SPAN></FONT></FONT></SPAN></FONT></P>
<P><FONT face=3DArial size=3D2><SPAN=20
class=3D317444306-14042004><verifyelement</SPAN></FONT></P>
<P><FONT face=3DArial size=3D2><SPAN =
class=3D317444306-14042004> =20
stepid=3D"Check for the phrase field"</SPAN></FONT></P>
<P><FONT face=3DArial size=3D2><SPAN =
class=3D317444306-14042004> =20
type=3D"input"</SPAN></FONT></P>
<P><FONT face=3DArial size=3D2><SPAN =
class=3D317444306-14042004> =20
text=3D"phrase"/></SPAN></FONT></P>
<P><FONT face=3DArial size=3D2><SPAN class=3D317444306-14042004>I get =
the error "More=20
than 1 element with type "input" and name "phrase" found!". This error =
makes=20
sense, the question is how to specify which input element I am referring =
to? I=20
see that you can use "regex", does anyone know if using this can help =
with this=20
problem, and if so can you give me an example?</SPAN></FONT></P>
<P><FONT size=3D2><SPAN class=3D317444306-14042004><FONT =
face=3DArial>Question=20
2:</FONT></SPAN></FONT></P>
<P><FONT size=3D2><SPAN class=3D317444306-14042004><FONT =
face=3DArial>The next problem=20
is if I want to use <STRONG>setinputfield </STRONG>to set this value, =
such=20
as:</FONT></SPAN></FONT></P><FONT size=3D2><SPAN =
class=3D317444306-14042004><FONT=20
color=3D#0000ff size=3D1>
<P><FONT face=3DArial color=3D#000000 size=3D2><</FONT></FONT><FONT=20
face=3DArial>setinputfield </FONT></P>
<P><FONT><FONT face=3DArial><SPAN =
class=3D317444306-14042004> =20
</SPAN>stepid=3D"set text to search for" </FONT></FONT></P>
<P><FONT><FONT><FONT face=3DArial><SPAN=20
class=3D317444306-14042004> </SPAN>name=3D"phrase"=20
</FONT></FONT></FONT></P>
<P><FONT><FONT><FONT><FONT face=3DArial><SPAN=20
class=3D317444306-14042004> =20
</SPAN>value=3D"credit"/></FONT></FONT></FONT></P></FONT></SPAN></FONT=
>
<P><FONT face=3DArial size=3D2><SPAN class=3D317444306-14042004>Is there =
a way for me=20
to specify which of the 2 instances of this element I am setting?=20
</SPAN></FONT></P>
<P><FONT face=3DArial size=3D2><SPAN =
class=3D317444306-14042004></SPAN></FONT><FONT=20
face=3DArial size=3D2><SPAN class=3D317444306-14042004>Thanks,=20
Shlomit</SPAN></FONT></P></FONT></FONT></DIV></BODY></HTML>
=00
------_=_NextPart_001_01C421F0.5587C985--