[Webtest] Re: Onblur event handler not fired

webtest@lists.canoo.com webtest@lists.canoo.com
Tue, 12 Apr 2005 11:03:28 +0530


Hi Marc,

I have checked the source of HtmlUnit as well as Webtest. HtmlUnit have
exposed API's to call the focus / blur event on the elements
(FocusableElemet and FocusableHostElement). These API's are not being
called from Webtest. Hence I am not sure whether this will be a change
only in the HtmlUnit source.

I tried calling the focus() just before we set the value in the text
box. This then triggered the focus event handler for current element and
blur event handler for the previous element.

Is this the correct way? Mind you the current JavaScript (onblur event
handler calling focus on some other element) that I have causes HtmlUnit
go in a recursive do while true loop.

Do let me know what would be the best approach. And also the changes
that I did to make it work are in the right direction or not.

Regards,
Vikram

Date: Mon, 11 Apr 2005 10:18:43 +0200
From: Marc Guillemot <mguillemot@yahoo.fr>
To: webtest@lists.canoo.com
Subject: Re: [Webtest] Onblur event handler not fired
Reply-To: webtest@lists.canoo.com

Hi,

as far as I know htmlunit doesn't executed onblur code currently. You
can look at htmlunit source code to improve it.

Marc.

vikrams@mastek.com wrote:
> Hi All,
>=20
> I had a problem with the webtest verification.
>=20
> In the code given below I have two input fields effDate and expDate.
>=20
> There is a JavaScript code on the onblur event of the effDate to
change=20
> the contents of expDate to the Current Date
>=20
> But when I do setInputfield for effDate with some date. The value in=20
> expDate doesn't change and the further verification of the expected=20
> effDate fails.
>=20
> That means the onblur event is not getting fired.Any suggestions or
bug=20
> fixes are welcome.
>=20
> Below is the code for the Html and Javascript  and also for WebTest =20
> test script.
>=20
> Html Page Code
>=20
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
>=20
> <%@ page language=3D "Java"%>
>=20
> <html>
>=20
> <head>
>=20
> <SCRIPT LANGUAGE=3D"JavaScript">
>=20
> function setExpDate(dateField) {
>=20
>         document.forms[0].expDate.value =3D "01/04/2006";
>=20
>         document.forms[0].expDate.focus();
>=20
> }
>=20
> </SCRIPT>
>=20
> </head>
>=20
> <body>
>=20
> <FORM METHOD=3DPOST ACTION=3D"_http://webtest.canoo.com_" =
name=3D"frmName"=20
> onsubmit=3D"return true;">
>=20
> <input type=3D"text" name=3D"effDate" maxlength=3D"10" tabindex=3D"7"=20
> value=3D"00/00/0000" onblur=3D"setExpDate(this)" style=3D"width: 125 =
px;">
>=20
> <input type=3D"text" name=3D"expDate" maxlength=3D"10" tabindex=3D"8"=20
> value=3D"00/00/0000" style=3D"width: 125 px;">
>=20
> <input type=3D"text" name=3D"hi" maxlength=3D"10" tabindex=3D"6" =
value=3D"hi"=20
> style=3D"width: 125 px;">
>=20
> <input type=3D"hidden" name=3D"promptForSave" value=3D"true">
>=20
> </FORM>
>=20
> </body>
>=20
> </html>
>=20
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
>=20
> Script
>=20
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
>=20
>   <steps>
>=20
>     <invoke url=3D"OnBlurTestRg.jsp" stepid=3D""/>
>=20
>     <setinputfield name=3D"effDate" value=3D"01/04/2005" stepid=3D""/>
>=20
>     <setinputfield name=3D"hi" value=3D"bye" stepid=3D""/>
>=20
>     <verifyinputfield name=3D"expDate" value=3D"01/04/2006" =
stepid=3D"Could=20
> not verify expriy date"/>
>=20
>   </steps>
>=20
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
>=20
> Error
>=20
> Caught exception: The following error occurred while executing this
line:
>=20
> E:\WebTest\OnBlurCheck.xml:19: Test failed.
>=20
> Test step verifyinputfield (E:\WebTest\OnBlurCheck.xml:35: )  named=20
> "Could not verify expriy date" failed with message "Step "verifyinput
>=20
> field "Could not verify expriy date" (5/6): Wrong contents found in=20
> input field:
>=20
>  expDate Expected <01/04/2006> but got <00/00/0000>"
>=20
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
>=20
> */Thanks & Regards/*/////
> /Vikram Shitole
> =20
>=20
> */"No one knows what he can do till he tries."/*
>=20
>=20
>=20
>=20
> MASTEK
> "Making a valuable difference"
> Mastek in NASSCOM's 'India Top 20' Software Service Exporters List.
> In the US, we're called MAJESCO
>=20
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Opinions expressed in this e-mail are those of the individual and not=20
> that of Mastek Limited, unless specifically indicated to that effect.=20
> Mastek Limited does not accept any responsibility or liability for it.

> This e-mail and attachments (if any) transmitted with it are=20
> confidential and/or privileged and solely for the use of the intended=20
> person or entity to which it is addressed. Any review,
re-transmission,=20
> dissemination or other use of or taking of any action in reliance upon

> this information by persons or entities other than the intended=20
> recipient is prohibited. This e-mail and its attachments have been=20
> scanned for the presence of computer viruses. It is the responsibility

> of the recipient to run the virus check on e-mails and attachments=20
> before opening them. If you have received this e-mail in error, kindly

> delete this e-mail from all computers.
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



--__--__--

_______________________________________________
WebTest mailing list
WebTest@lists.canoo.com
http://lists.canoo.com/mailman/listinfo/webtest


End of WebTest Digest