[Webtest] Javascript buttons

Lisa Crispin webtest@lists.canoo.com
Mon, 22 Nov 2004 17:20:50 +0000


--NextPart_Webmail_9m3u9jl4l_12052_1101144050_0
Content-Type: text/plain
Content-Transfer-Encoding: 8bit

I've been meaning to install Firefox, here's another good reason to do so (even though I have to do most of my testing in IE).

Thanks, I agree it is not urgent, works fine for us as is.
-- Lisa

-------------- Original message from Marc Guillemot <mguillemot@yahoo.fr>: -------------- 


> Hi Lisa, 
> 
> a "normal" validator would notify a warning for an input outside a form (if you 
> use Mozilla/Firefox, you can use the 
> great plugin "HTML VALIDATOR (based on Tidy)" that displays validation results 
> when looking at the source of a html file 
> direct from the browser: http://users.skynet.be/mgueury/mozilla/) 
> 
> Back to your "input": the difference comes from the current way used by 
> "clickbutton" to locate the button. When the 
> html id is specified it asks directly the document for the element with this id. 
> It is therfore found even outside a 
> 
. Without html id, all the forms are examined to look if one of them 
> contains the desired button. I agree that 
> this could be changed to find inputs even when they are outside a form but I 
> don't see this as very urgent 
> 
> Marc. 
> 
> Lisa Crispin wrote: 
> > Hi Marc, 
> > We had considered that, but I ran the html through a validator and it 
> > did not complain about not having a form. We can see why you would say 
> > this, though. 
> > 
> > I still have a question however: If the form is required, then why does 
> > it work using htmlid and no form? 
> > Thanks (as always for your wonderful help!) 
> > Lisa 
> > 
> > -------------- Original message from Marc Guillemot 
> > : -------------- 
> > 
> > 
> > > Hi Lisa, 
> > > 
> > > your html page is not valid: the input should be surrounded by a 
> > form. After 
> > > having fixed that, everything works right 
> > > for me. 
> > > 
> > > NB: the kind of simple example you sent was exactly right: as 
> > small as possible 
> > > to allow someone else to test it without 
> > > first having to understand some private business logic. 
> > > 
> > > Marc. 
> > > 
> > > 
> > > Lisa Crispin wrote: 
> > > > 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!) 
> > > > 
> > > > 
> > > > 
> > > > 
> > > > 
> > > > 
> > > > 
> > > > 
> > > > 
> > > > 
> > > > 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'. 
> > > > 
> > > > 
> > > > 
> > > > url="/javascript_test/test3.html"/> 
> > > > 
> > > > 
> > > > text="This is Canoo Test 3"/> 
> > > > 
> > > > 
> > > > 
> > > > 
> > > > 
> > > > name="testButtonName" /> 
> > > > 
> > > > 
> > > > 
> > > > 
> > > > 
> > > > Thanks, 
> > > > Lisa 
> > > > 
> > > > 
> > > > 
> > > > -------------- Original message from Marc Guillemot 
> > > > : -------------- 
> > > > 
> > > > 
> > > > > 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 
> > > > 
> > > 
> > > _______________________________________________ 
> > > WebTest mailing list 
> > > WebTest@lists.canoo.com 
> > > http://lists.canoo.com/mailman/listinfo/webtest 
> > 
> 
> _______________________________________________ 
> WebTest mailing list 
> WebTest@lists.canoo.com 
> http://lists.canoo.com/mailman/listinfo/webtest 
--NextPart_Webmail_9m3u9jl4l_12052_1101144050_0
Content-Type: text/html
Content-Transfer-Encoding: 8bit

<html>
<!-- BEGIN WEBMAIL STATIONERY -->
<head></head>
<body>
<!-- WEBMAIL STATIONERY noneset -->
<DIV></DIV>
<DIV>I've been meaning to install Firefox, here's another good reason to do so (even though I have to do most of my testing in IE).</DIV>
<DIV>&nbsp;</DIV>
<DIV>Thanks, I agree it is not urgent, works fine for us as is.</DIV>
<DIV>-- Lisa<BR></DIV>
<BLOCKQUOTE style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid">-------------- Original message from Marc Guillemot &lt;mguillemot@yahoo.fr&gt;: -------------- <BR><BR><BR>&gt; Hi Lisa, <BR>&gt; <BR>&gt; a "normal" validator would notify a warning for an input outside a form (if you <BR>&gt; use Mozilla/Firefox, you can use the <BR>&gt; great plugin "HTML VALIDATOR (based on Tidy)" that displays validation results <BR>&gt; when looking at the source of a html file <BR>&gt; direct from the browser: http://users.skynet.be/mgueury/mozilla/) <BR>&gt; <BR>&gt; Back to your "input": the difference comes from the current way used by <BR>&gt; "clickbutton" to locate the button. When the <BR>&gt; html id is specified it asks directly the document for the element with this id. <BR>&gt; It is therfore found even outside a <BR>&gt; 
<FORM>. Without html id, all the forms are examined to look if one of them <BR>&gt; contains the desired button. I agree that <BR>&gt; this could be changed to find inputs even when they are outside a form but I <BR>&gt; don't see this as very urgent <BR>&gt; <BR>&gt; Marc. <BR>&gt; <BR>&gt; Lisa Crispin wrote: <BR>&gt; &gt; Hi Marc, <BR>&gt; &gt; We had considered that, but I ran the html through a validator and it <BR>&gt; &gt; did not complain about not having a form. We can see why you would say <BR>&gt; &gt; this, though. <BR>&gt; &gt; <BR>&gt; &gt; I still have a question however: If the form is required, then why does <BR>&gt; &gt; it work using htmlid and no form? <BR>&gt; &gt; Thanks (as always for your wonderful help!) <BR>&gt; &gt; Lisa <BR>&gt; &gt; <BR>&gt; &gt; -------------- Original message from Marc Guillemot <BR>&gt; &gt; <MGUILLEMOT@YAHOO.FR>: -------------- <BR>&gt; &gt; <BR>&gt; &gt; <BR>&gt; &gt; &gt; Hi Lisa, <BR>&gt; &gt; &gt; <BR>&gt; &gt; &gt; your html page is not valid: the input should be surrounded by a <BR>&gt; &gt; form. After <BR>&gt; &gt; &gt; having fixed that, everything works right <BR>&gt; &gt; &gt; for me. <BR>&gt; &gt; &gt; <BR>&gt; &gt; &gt; NB: the kind of simple example you sent was exactly right: as <BR>&gt; &gt; small as possible <BR>&gt; &gt; &gt; to allow someone else to test it without <BR>&gt; &gt; &gt; first having to understand some private business logic. <BR>&gt; &gt; &gt; <BR>&gt; &gt; &gt; Marc. <BR>&gt; &gt; &gt; <BR>&gt; &gt; &gt; <BR>&gt; &gt; &gt; Lisa Crispin wrote: <BR>&gt; &gt; &gt; &gt; Hi Marc, <BR>&gt; &gt; &gt; &gt; When we did further testing using our little sample page, we <BR>&gt; &gt; found that <BR>&gt; &gt; &gt; &gt; clickbutton using htmlid would work, but not using label or <BR>&gt; &gt; name. We <BR>&gt; &gt; &gt; &gt; don't use htmlid up to now, but we can add it to work around this <BR>&gt; &gt; &gt; &gt; problem. However, it looks like a bug to me that clickbutton <BR>&gt; &gt; with name <BR>&gt; &gt; &gt; &gt; or label doesn't work in this case. Here is the HTML (the <BR>&gt; &gt; button just <BR>&gt; &gt; &gt; &gt; goes to www.yahoo.com , which gets an error itself <BR>&gt; &gt; &gt; &gt; when WebTest gets to it, but we're not debugging Yahoo's <BR>&gt; &gt; problems!) <BR>&gt; &gt; &gt; &gt; <BR>&gt; &gt; &gt; &gt; <BR>&gt; &gt; &gt; &gt; <BR>&gt; &gt; &gt; &gt; <BR>&gt; &gt; &gt; &gt; <BR>&gt; &gt; &gt; &gt; <BR>&gt; &gt; &gt; &gt; <BR>&gt; &gt; &gt; &gt; <BR>&gt; &gt; &gt; &gt; <BR>&gt; &gt; &gt; &gt; <BR>&gt; &gt; &gt; &gt; Here is my WebTest code (is this what you need?) I have 3 <BR>&gt; &gt; clickbuttons, <BR>&gt; &gt; &gt; &gt; uncomment each one and try. One works (with htmlid) and the <BR>&gt; &gt; other two <BR>&gt; &gt; &gt; &gt; get 'No button found'. <BR>&gt; &gt; &gt; &gt; <BR>&gt; &gt; &gt; &gt; <BR>&gt; &gt; &gt; &gt; <BR>&gt; &gt; &gt; &gt; url="/javascript_test/test3.html"/&gt; <BR>&gt; &gt; &gt; &gt; <BR>&gt; &gt; &gt; &gt; <BR>&gt; &gt; &gt; &gt; text="This is Canoo Test 3"/&gt; <BR>&gt; &gt; &gt; &gt; <BR>&gt; &gt; &gt; &gt; <BR>&gt; &gt; &gt; &gt; <BR>&gt; &gt; &gt; &gt; <BR>&gt; &gt; &gt; &gt; <BR>&gt; &gt; &gt; &gt; name="testButtonName" /&gt; <BR>&gt; &gt; &gt; &gt; <BR>&gt; &gt; &gt; &gt; <BR>&gt; &gt; &gt; &gt; <BR>&gt; &gt; &gt; &gt; <BR>&gt; &gt; &gt; &gt; <BR>&gt; &gt; &gt; &gt; Thanks, <BR>&gt; &gt; &gt; &gt; Lisa <BR>&gt; &gt; &gt; &gt; <BR>&gt; &gt; &gt; &gt; <BR>&gt; &gt; &gt; &gt; <BR>&gt; &gt; &gt; &gt; -------------- Original message from Marc Guillemot <BR>&gt; &gt; &gt; &gt; : -------------- <BR>&gt; &gt; &gt; &gt; <BR>&gt; &gt; &gt; &gt; <BR>&gt; &gt; &gt; &gt; &gt; Lisa, <BR>&gt; &gt; &gt; &gt; &gt; <BR>&gt; &gt; &gt; &gt; &gt; current version support javascript buttons and some tests are <BR>&gt; &gt; &gt; &gt; contained in the <BR>&gt; &gt; &gt; &gt; &gt; selftests. Can you provide a minimal <BR>&gt; &gt; &gt; &gt; &gt; (always the same thing) sample of the problem? <BR>&gt; &gt; &gt; &gt; &gt; <BR>&gt; &gt; &gt; &gt; &gt; Marc. <BR>&gt; &gt; &gt; &gt; &gt; <BR>&gt; &gt; &gt; &gt; &gt; Lisa Crispin wrote: <BR>&gt; &gt; &gt; &gt; &gt; &gt; Using build 560, clickbutton can't find the button if it is a <BR>&gt; &gt; &gt; &gt; Javascript <BR>&gt; &gt; &gt; &gt; &gt; &gt; button (this didn't work with the HTTPUnit WebTest either). <BR>&gt; &gt; &gt; &gt; Here's an <BR>&gt; &gt; &gt; &gt; &gt; &gt; example: <BR>&gt; &gt; &gt; &gt; &gt; &gt; <BR>&gt; &gt; &gt; &gt; &gt; &gt; type="button" value="Review" onclick="javascript: <BR>&gt; &gt; location.href = <BR>&gt; &gt; &gt; &gt; &gt; &gt; '/plan/reviewCompensation.vm';"&gt; <BR>&gt; &gt; &gt; &gt; &gt; &gt; <BR>&gt; &gt; &gt; &gt; &gt; &gt; Does the HtmlUnit-based WebTest support Javascript buttons? <BR>&gt; &gt; &gt; &gt; &gt; &gt; Thank you, <BR>&gt; &gt; &gt; &gt; &gt; &gt; Lisa <BR>&gt; &gt; &gt; &gt; &gt; &gt; <BR>&gt; &gt; &gt; &gt; &gt; <BR>&gt; &gt; &gt; &gt; &gt; _______________________________________________ <BR>&gt; &gt; &gt; &gt; &gt; WebTest mailing list <BR>&gt; &gt; &gt; &gt; &gt; WebTest@lists.canoo.com <BR>&gt; &gt; &gt; &gt; &gt; http://lists.canoo.com/mailman/listinfo/webtest <BR>&gt; &gt; &gt; &gt; <BR>&gt; &gt; &gt; <BR>&gt; &gt; &gt; _______________________________________________ <BR>&gt; &gt; &gt; WebTest mailing list <BR>&gt; &gt; &gt; WebTest@lists.canoo.com <BR>&gt; &gt; &gt; http://lists.canoo.com/mailman/listinfo/webtest <BR>&gt; &gt; <BR>&gt; <BR>&gt; _______________________________________________ <BR>&gt; WebTest mailing list <BR>&gt; WebTest@lists.canoo.com <BR>&gt; http://lists.canoo.com/mailman/listinfo/webtest </BLOCKQUOTE></FORM>
<!-- END WEBMAIL STATIONERY -->

</body>
</html>

--NextPart_Webmail_9m3u9jl4l_12052_1101144050_0--