[Webtest] Javascript buttons
Lisa Crispin
webtest@lists.canoo.com
Thu, 18 Nov 2004 20:32:27 +0000
--NextPart_Webmail_9m3u9jl4l_9347_1100809947_0
Content-Type: text/plain
Content-Transfer-Encoding: 8bit
Hi Marc,
When we did further testing using our little sample page, we found that clickbutton using htmlid would work, but not using label or name. We don't use htmlid up to now, but we can add it to work around this problem. However, it looks like a bug to me that clickbutton with name or label doesn't work in this case. Here is the HTML (the button just goes to www.yahoo.com, which gets an error itself when WebTest gets to it, but we're not debugging Yahoo's problems!)
<html>
<head>
<title>This is Canoo Test 3</title>
</head>
<body>
<input type="button" value="Goto Yahoo" onclick="javascript: location.href = 'http://www.yahoo.com';">
</body>
</html>
Here is my WebTest code (is this what you need?) I have 3 clickbuttons, uncomment each one and try. One works (with htmlid) and the other two get 'No button found'.
<steps>
<invoke stepid="get page"
url="/javascript_test/test3.html"/>
<verifytitle stepid="verify page"
text="This is Canoo Test 3"/>
<!-- clickbutton using htmlid works - the button is clicked (the resulting page, Yahoo home page, causes a different error) -->
<!-- <clickbutton stepid="click the javascript button by id"
htmlid="testButtonId" /> -->
<!-- Click button using name or label gets a 'No button found' error' -->
<clickbutton stepid="click the javascript button by name"
name="testButtonName" />
<!-- <clickbutton stepid="click the javascript button by label"
label="GoTo Yahoo" /> -->
</steps>
Thanks,
Lisa
-------------- Original message from Marc Guillemot <mguillemot@yahoo.fr>: --------------
> Lisa,
>
> current version support javascript buttons and some tests are contained in the
> selftests. Can you provide a minimal
> (always the same thing) sample of the problem?
>
> Marc.
>
> Lisa Crispin wrote:
> > Using build 560, clickbutton can't find the button if it is a Javascript
> > button (this didn't work with the HTTPUnit WebTest either). Here's an
> > example:
> > > > type="button" value="Review" onclick="javascript: location.href =
> > '/plan/reviewCompensation.vm';">
> >
> > Does the HtmlUnit-based WebTest support Javascript buttons?
> > Thank you,
> > Lisa
> >
>
> _______________________________________________
> WebTest mailing list
> WebTest@lists.canoo.com
> http://lists.canoo.com/mailman/listinfo/webtest
--NextPart_Webmail_9m3u9jl4l_9347_1100809947_0
Content-Type: text/html
Content-Transfer-Encoding: 8bit
<html>
<!-- BEGIN WEBMAIL STATIONERY -->
<head></head>
<body>
<!-- WEBMAIL STATIONERY noneset -->
<DIV></DIV>
<DIV>Hi Marc,</DIV>
<DIV>When we did further testing using our little sample page, we found that clickbutton using htmlid would work, but not using label or name. We don't use htmlid up to now, but we can add it to work around this problem. However, it looks like a bug to me that clickbutton with name or label doesn't work in this case. Here is the HTML (the button just goes to <A href="http://www.yahoo.com">www.yahoo.com</A>, which gets an error itself when WebTest gets to it, but we're not debugging Yahoo's problems!)</DIV>
<DIV> </DIV>
<DIV><html><BR><head><BR><title>This is Canoo Test 3</title><BR></head><BR><body><BR><input type="button" value="Goto Yahoo" onclick="javascript: location.href = 'http://www.yahoo.com';"> <BR></body><BR></html></DIV>
<DIV> </DIV>
<DIV>Here is my WebTest code (is this what you need?) I have 3 clickbuttons, uncomment each one and try. One works (with htmlid) and the other two get 'No button found'.</DIV>
<DIV> </DIV>
<DIV> <steps></DIV>
<DIV> <invoke stepid="get page"<BR> url="/javascript_test/test3.html"/><BR> <BR> <verifytitle stepid="verify page"<BR> text="This is Canoo Test 3"/></DIV>
<DIV> <!-- clickbutton using htmlid works - the button is clicked (the resulting page, Yahoo home page, causes a different error) --><BR> <!-- <clickbutton stepid="click the javascript button by id"<BR> htmlid="testButtonId" /> --> <BR> <BR><!-- Click button using name or label gets a 'No button found' error' --> <BR> <clickbutton stepid="click the javascript button by name"<BR> name="testButtonName" /> <BR> <BR><!-- <clickbutton stepid="click the javascript button by label"<BR> label="GoTo Yahoo" /> --><BR> <BR> </steps></DIV>
<DIV> </DIV>
<DIV>Thanks,</DIV>
<DIV>Lisa</DIV>
<DIV><BR> </DIV>
<BLOCKQUOTE style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid">-------------- Original message from Marc Guillemot <mguillemot@yahoo.fr>: -------------- <BR><BR><BR>> Lisa, <BR>> <BR>> current version support javascript buttons and some tests are contained in the <BR>> selftests. Can you provide a minimal <BR>> (always the same thing) sample of the problem? <BR>> <BR>> Marc. <BR>> <BR>> Lisa Crispin wrote: <BR>> > Using build 560, clickbutton can't find the button if it is a Javascript <BR>> > button (this didn't work with the HTTPUnit WebTest either). Here's an <BR>> > example: <BR>> > <INPUT class=wideButton name=ReviewEmployeePayrollSummary <BR>> > type="button" value="Review" onclick="javascript: location.href = <BR>> > '/plan/reviewCompensation.vm';"> <BR>> > <BR>> > Does the HtmlUnit-based WebTest support Javascript buttons? <BR>> > Thank you, <BR>> > Lisa <BR>> > <BR>> <BR>> _______________________________________________ <BR>> WebTest mailing list <BR>> WebTest@lists.canoo.com <BR>> http://lists.canoo.com/mailman/listinfo/webtest </BLOCKQUOTE>
<!-- END WEBMAIL STATIONERY -->
</body>
</html>
--NextPart_Webmail_9m3u9jl4l_9347_1100809947_0--