[Webtest] Newbie help with logon using form and javascript ...

Lisa Crispin webtest@lists.canoo.com
Wed, 01 Sep 2004 19:33:40 +0000


Hi James,
Oddly, I got a Javascript error replying to your email!

I'm not an expert at WebTest but here is what I have learned about clicking buttons.

I haven't been able to click any buttons that have Javascript in a WebTest script.  Either I get the programmers to remove the Javascript or provide a way to turn it off for testing.  Or, if that can't be done, I just have to use invoke to get to the page I want, which isn't a great solution but it lets the test continue.

Here is a hint that may or may not help (I don't think it will help with javascript):
button code:   <clickbutton
			stepid="Click Next Page button"
			label="" >
				<form name="rate_form" />
				<index value="0" />
			</clickbutton>

-- Lisa




-------------- Original message from "Burnash, James (James)** CTR **" : -------------- 

> 
> All, 
> 
> Greetings! I am a VERY new user of WebTest, as well as Ant, but have some 
> experience with XML - but none with Java Script or Java itself :-( 
> 
> 
> I'm trying to get the login on the following page to work - but the Submit 
> button on the page is un-named, and there is no action= for that button. It 
> appears to me that a Javascript function is called when that button is clicked, 
> so I've tried using ClickButton - to no avail - I get a button not found error. 
> 
> I've attached my Ant/WebTest build file, and the build output below as well. 
> 
> I apologize for my ignorance in these matters - but I am a technical person, so 
> don't hold back. 
> 
> James J Burnash 
> Systems Engineer 
> 
> Here's the build script: 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> > host="ebizunixtest2.bla.com" 
> protocol="http" 
> port="20060" 
> basepath="" /> 
> 
> > stepid="go to CMS Login page" 
> url="html/CMSLogin.htm"/> 
> > stepid="we should see the CMS Login title" 
> text="CMS Login" /> 
> > name="Login" /> 
> > name="USER" 
> value="burnash" /> 
> > name="PASSWORD" 
> value="ironwall14" /> 
> 
> > stepid="we should see the CMS Select Task title" 
> text="CMS Select Task Page" /> 
> 
> 
> 
> 
> 
> 
> Here's the page source: 
> 
> 
> 
> > href="../stylesheets/style.css" rel=stylesheet type=text/css> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> > marginheight="0" marginwidth="0"> 
> 
> 
> 
> value=ISO-8859-1>  > name=target type=hidden value="/release/ECMSMainHomePage"> > name=smauthreason type=hidden value=0> > value=loginForm>  
> 
> 
> 
> 
> 
> 
> 
>  
>  
>  

> 
>  
>  
>  
> > src="../images/transpixel.gif" width=10>

> 
> 

> 
> > type="block">

> 
> > type="block">

> 
> 
> 
> > src="../images/transpixel.gif" width=195>
> 
> > width=98>
> > src="../images/dottedv_home.gif" width=9> 
> 
> 
> 
> 
> > width=10>
> > src="../images/title_ecms2.gif" width=189>

> 
>  
>  

> > src="../images/logo.gif" width=215>

> 
> 
> 
> 
> 
> > type="block">
> > type="block">
> > type="block">

> 
> 
>  
> 

> 
> 
> 

> 
> 
>   
> > type="block">

> > src="../images/curve.gif" width=9>

> 
> > type="block">
> 
> > type="block">

> 
> 
> 
> 
> 
 
> 

> 
> 
> 
> 
>  

> 
> 
> 
> ECMS Login

> 
> 

> 
> 
Enter your NT username and password, then 
> click the Submit button.


> 
> 
> 
> 
> 
>  

> 
> User Name

> 
>  


> 
> 
> 
> 

> 
>  

> 
> Password

> 
>  
> 

> 
>  

> 
>   

> 
> 
> 
> 
> 
> > src="../images/blank.gif" 
> width=1>


> 
>  

> 
> > src="../images/buttons/bc_Submit.gif" type=image> 
>    > href="javascript:clearFields(this)">> 
> src="../images/buttons/bc_Clear.gif">

> BODY>
> 
> 
> 
> 
> 
>  

> 
> > type="block">


> 
> 
> 
> ... and here's the output from Ant / WebTest ... 
> 
> Buildfile: ECMSLogin.xml 
> 
> main: 
> [testSpec] INFO (Step.java:211) - Start Step: null "[implict setup step]" 
> (1/9) 
> [testSpec] INFO (Step.java:206) - Completed Step: null "[implict setup step]" 
> (1/9) 
> [testSpec] INFO (Step.java:211) - Start Step: invoke "go to CMS Login page" 
> (2/9) 
> [testSpec] INFO (Target.java:146) - -> gotoTarget(by url): 
> http://ebizunixtest2.bla.com:20060/html/Login.htm 
> [testSpec] INFO (Context.java:190) - Current form set to none 
> [testSpec] INFO (Step.java:206) - Completed Step: invoke "go to CMS Login 
> page" (2/9) 
> [testSpec] INFO (Step.java:211) - Start Step: verifytitle "we should see the 
> CMS Login title" (3/9) 
> [testSpec] INFO (Step.java:206) - Completed Step: verifytitle "we should see 
> the CMS Login title" (3/9) 
> [testSpec] INFO (Step.java:211) - Start Step: new_selectform "" (4/9) 
> [testSpec] INFO (Context.java:188) - Current form set to (action=/login.fcc) 
> [testSpec] INFO (Step.java:206) - Completed Step: new_selectform "" 
> (4/9) 
> [testSpec] INFO (Step.java:211) - Start Step: setinputfield "set user name" 
> (5/9) 
> [testSpec] INFO (Step.java:206) - Completed Step: setinputfield "set user 
> name" (5/9) 
> [testSpec] INFO (Step.java:211) - Start Step: setinputfield "set password" 
> (6/9) 
> [testSpec] INFO (Step.java:206) - Completed Step: setinputfield "set password" 
> (6/9) 
> [testSpec] INFO (Step.java:211) - Start Step: clickbutton "Click the submit 
> button" (7/9) 
> 
> BUILD FAILED 
> C:\webtest\doc\samples\ECMSLogin.xml:13: Test failed. 
> Test step clickbutton named "Click the submit button" failed with message 
> "Button with name <> and value not found!" 
> 
> Total time: 5 seconds 
> _______________________________________________ 
> WebTest mailing list 
> WebTest@lists.canoo.com 
> http://lists.canoo.com/mailman/listinfo/webtest