[Webtest] WebTest clicklink fail

Marc Guillemot Marc Guillemot <mguillemot@yahoo.fr>
Thu, 10 May 2007 20:52:22 +0200


Hi,

how does your clickLink fail? Does it produce some error or does is it
just successful but without getting a new page?

Your js code looks simple and shouldn't be a problem for WebTest
(neither 2.1 nor 2.5). For 2.1 I could imagine that the default answer
to confirm was false (I don't remember exactly when the change has been
done) what could explain that nothing happens. Nevertheless the default
behavior for confirm is now true so this shouldn't be a problem with
2.5. To precisely specify what should happen you can give a try to
<expectDialogs ...>.

Last (but not least), to "see" what happens, I recommend you to turn the
log level to debug (see lib/log4j.properties) and look at what is
printed to the log when the link is clicked.

Marc.

Francisco Javier Martin Gutierrez wrote:
> Hello:
> 
> Since I have been testing with webtest it had never failed like now. I begin
> to believe that webtest do all it can do. But something is going wrong since
> two days ago.
> 
> Webtest (version 2.1 = R_1515 and version = 2.5 R_1538) can't fail following
> a clickButton image or a clikLink. The page works well on iexplore but
> webtest can't do it. I think it may be that there's some unsupported
> javascript on the page. But how can I be sure of this?
> 
> The page code is: 
> href="javascript:eliminar('10101A', 'prueba marcos');"
> 
> And the javascript function is:
> function eliminar(codValoracion, nomValoracion) {
>   document.forms[0].codValoracion.value=codValoracion;
>   document.forms[0].nomValoracion.value=nomValoracion;
>   document.forms[0].modo.value="listado";
>   document.forms[0].accion.value="eliminar";
>   if(confirm("¿Está seguro de que desea eliminar la Valoración  '" +
> codValoracion + " : " + nomValoracion + "' de la lista de favoritas?")){
>   	document.forms[0].submit();
>   }
>       
> }
> 
> I can't execute a scriptStep because it doesn't provide the mechanism to
> call JavaScript functions in my HTML pages under test as it is told in the
> manual. If you execute a scriptStep at the next form:
> 
> <scriptStep description="boton eliminar" language="javascript">
> 					
> 	codValoracion='10101A';
> 	nomValoracion='prueba marcos';
> 	
> document.forms[0].codValoracion.value=codValoracion;
> 	
> document.forms[0].nomValoracion.value=nomValoracion;
> 	document.forms[0].modo.value="listado";
> 	document.forms[0].accion.value="eliminar";
> 	if(confirm("¿Está seguro de que desea eliminar la Valoración  '" +
> codValoracion + " : " + nomValoracion + "' de la lista de
> favoritas?")){
>   		document.forms[0].submit();
> 	 }
> </scriptStep>
> 
> The error message obtained is:
> 
> [scriptStep]  INFO (com.canoo.webtest.steps.Step) - >>>> Start Step:
> scriptStep "boton eliminar" (31/32)
> [scriptStep] ERROR (org.apache.bsf.BSFManager) - Exception :
> [scriptStep] java.security.PrivilegedActionException:
> org.apache.bsf.BSFException: JavaScript Error: Internal Error: org
> .mozilla.javascript.EcmaError: TypeError: Cannot read property "0.0" from
> undefined
> ...
> [scriptStep]  INFO (com.canoo.webtest.steps.Step) - Exception thrown from
> this class: com.canoo.webtest.engine.StepExecu
> tionException
> [scriptStep]  INFO (com.canoo.webtest.steps.Step) - Message was: Error
> invoking script: org.mozilla.javascript.EcmaError
> : TypeError: Cannot read property "0.0" from undefined
>  INFO (com.canoo.webtest.steps.Step) - Running with: Canoo Webtest: R_1515.
> 
> 
> What can I do?
> 
> Francisco Javier Martín 
> Desarrollo de Proyectos - Valladolid
> Security Solutions & Services Division 	
> 	 
> Edif. Solar, Of. 13, 14, 15
> Parque Tecnológico Boecillo. 47151 Valladolid. España
> Tel.: 983 54 65 55   Fax: 983 54 66 09	 
> 
> 
> AVISO LEGAL: La informacion contenida en este mensaje y cualquier documento adjunto en el mismo es confidencial, puede estar legalmente protegida y esta dirigida solamente al destinatario. La publicacion, uso, distribucion, impresion o copia no autorizada del contenido de este mensaje, esta estrictamente prohibida y puede ser ilegal. Si Vd. ha recibido este mensaje por error, le rogamos destruya el mensaje y lo notifique al remitente o llame al telefono (+34) 91 556 92 62.
> 
> DISCLAIMER: The information contained in this message and any attached document is confidential, covered by law and intended solely for the recipient. The distribution, print, publication, unauthorised copy and / or use of the message content is strictly forbidden and could be deemed illegal. If you are not the intended recipient of this message, we request that you destroy it and notify the sender either in writing or by calling ++34 91 556 92 62.
> 
> _______________________________________________
> WebTest mailing list
> WebTest@lists.canoo.com
> http://lists.canoo.com/mailman/listinfo/webtest
>