[Webtest] javascript link

Francisco Javier Martin Gutierrez francisco-javier.martin@thalesgroup.com
Wed, 30 May 2007 17:14:23 +0200


Hi:

I need to follow a javascript link but it does not work. I try using
clicklink and storeregex but both fail. There are more than one links =
like
this:
<!--<td align=3D"center" bgcolor=3D"#FBFBFB">	<a
href=3D"javascript:eliminar('10101A', 'prueba marcos');"><img
src=3D"imagenes/ico_eliminar.gif" alt=3D"eliminar" width=3D"8" =
height=3D"9"
border=3D"0"></a></td>-->

If I try:=20
  <clickLink	description=3D"Click link: click boton: Eliminar"
    href=3D"javascript:eliminar('10101A', 'prueba marcos');"

Output is:
[ifStep]  INFO (com.canoo.webtest.steps.Step) - >>>> Start Step: ifStep
(54/56)
[condition]  INFO (com.canoo.webtest.steps.Step) - >>>> Start Step:
condition (54/56)
[verifyText]  INFO (com.canoo.webtest.steps.Step) - >>>> Start Step:
verifyText "Texto presente: 10101A" (54/56)
[expectDialog]  INFO (com.canoo.webtest.steps.Step) - >>>> Start Step:
expectDialog "Esta seguro que desea eliminar la valoracion..." (54/56)
[clickLink]  INFO (com.canoo.webtest.steps.Step) - >>>> Start Step:
clickLink "Click link: click boton: Eliminar" (54/56)
[clickLink]  INFO (com.canoo.webtest.steps.request.AbstractTargetAction) =
-
-> gotoTarget by clickLink
[not]  INFO (com.canoo.webtest.steps.Step) - >>>> Start Step: not =
(55/56)
[verifyText]  INFO (com.canoo.webtest.steps.Step) - >>>> Start Step:
verifyText "Texto presente: 10101A" (55/56)
 INFO (com.canoo.webtest.steps.Step) - Running with: Canoo Webtest: =
R_1561.
 INFO (com.canoo.webtest.steps.Step) - Exception thrown from this class:
com.canoo.webtest.engine.StepFailedException
 INFO (com.canoo.webtest.steps.Step) - Message was: Wrapped step did not
fail: null
 INFO (com.canoo.webtest.steps.Step) - Running with: Canoo Webtest: =
R_1561.
 INFO (com.canoo.webtest.steps.Step) - Exception thrown from this class:
com.canoo.webtest.engine.StepFailedException
 INFO (com.canoo.webtest.steps.Step) - Message was: Wrapped step did not
fail: null
Adding reference: ant.PropertyHelper
 INFO (com.canoo.webtest.ant.WebtestTask) - Finished executing webtest
"PruebaPc004" (C:\webtest 2.5\SAUSS\PruebaPc004b.
xml:50: )
 INFO (com.canoo.webtest.ant.WebtestTask) - Test report successfully
created.

BUILD FAILED
C:\webtest 2.5\SAUSS\PruebaPc004b.xml:50: Canoo Webtest: R_1561.
Test failed.
Test step steps (C:\webtest 2.5\SAUSS\PruebaPc004b.xml:53: ) null failed
with message "Wrapped step did not fail: null"
        at
com.canoo.webtest.ant.WebtestTask.stopBuildIfNeeded(WebtestTask.java:228)=

        at =
com.canoo.webtest.ant.WebtestTask.execute(WebtestTask.java:175)
        at
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
        at org.apache.tools.ant.Task.perform(Task.java:364)
        at org.apache.tools.ant.Target.execute(Target.java:341)
        at org.apache.tools.ant.Target.performTasks(Target.java:369)
        at
org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
        at
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecuto=
r.j
ava:40)
        at =
org.apache.tools.ant.Project.executeTargets(Project.java:1068)
        at org.apache.tools.ant.Main.runBuild(Main.java:668)
        at org.apache.tools.ant.Main.startAnt(Main.java:187)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)




So I though that I could store the link contained in javascript function =
but
it also failed. I tried:
<storeRegEx=20
      description=3D"Extract target location from javascript command"
      =
text=3D".*name=3D&quot;href&quot;.*href=3D&quot;javascript:eliminar(10101=
A,
prueba marcos)&quot;"
      property=3D"targetLocation" />
    <invoke=20
      description=3D"Invoke target page specified in the javascript =
statement"
      url=3D"#{targetLocation}"
      save=3D"targetPage" />


But It also fails:
[expectDialog]  INFO (com.canoo.webtest.steps.Step) - >>>> Start Step:
expectDialog "Esta seguro que desea eliminar la valoracion..." (55/57)
[storeRegEx]  INFO (com.canoo.webtest.steps.Step) - >>>> Start Step:
storeRegEx "Extract target location from javascript command" (55/57)
[storeRegEx]  INFO (com.canoo.webtest.steps.Step) - Running with: Canoo
Webtest: R_1561.
[storeRegEx]  INFO (com.canoo.webtest.steps.Step) - Exception thrown =
from
this class: com.canoo.webtest.engine.StepFailedException
[storeRegEx]  INFO (com.canoo.webtest.steps.Step) - Message was: No =
match
for regular expression =
<.*name=3D"href".*href=3D"javascript:eliminar('10101A',
'prueba marcos')">
 INFO (com.canoo.webtest.steps.Step) - Running with: Canoo Webtest: =
R_1561.
 INFO (com.canoo.webtest.steps.Step) - Exception thrown from this class:
com.canoo.webtest.engine.StepFailedException
 INFO (com.canoo.webtest.steps.Step) - Message was: No match for regular
expression <.*name=3D"href".*href=3D"javascript:eliminar('10101A', =
'prueba
marcos')">
 INFO (com.canoo.webtest.steps.Step) - Running with: Canoo Webtest: =
R_1561.
 INFO (com.canoo.webtest.steps.Step) - Exception thrown from this class:
com.canoo.webtest.engine.StepFailedException
 INFO (com.canoo.webtest.steps.Step) - Message was: No match for regular
expression <.*name=3D"href".*href=3D"javascript:eliminar('10101A', =
'prueba
marcos')">
Adding reference: ant.PropertyHelper
 INFO (com.canoo.webtest.ant.WebtestTask) - Finished executing webtest
"PruebaPc004" (C:\webtest 2.5\SAUSS\PruebaPc004b.xml:50: )
 INFO (com.canoo.webtest.ant.WebtestTask) - Test report successfully
created.

BUILD FAILED
C:\webtest 2.5\SAUSS\PruebaPc004b.xml:50: Canoo Webtest: R_1561.
Test failed.
Test step steps (C:\webtest 2.5\SAUSS\PruebaPc004b.xml:53: ) null failed
with message "No match for regular expression <
.*name=3D"href".*href=3D"javascript:eliminar('10101A', 'prueba =
marcos')">"
        at
com.canoo.webtest.ant.WebtestTask.stopBuildIfNeeded(WebtestTask.java:228)=

        at =
com.canoo.webtest.ant.WebtestTask.execute(WebtestTask.java:175)
        at
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
        at org.apache.tools.ant.Task.perform(Task.java:364)
        at org.apache.tools.ant.Target.execute(Target.java:341)
        at org.apache.tools.ant.Target.performTasks(Target.java:369)
        at
org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
        at
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecuto=
r.j
ava:40)
        at =
org.apache.tools.ant.Project.executeTargets(Project.java:1068)
        at org.apache.tools.ant.Main.runBuild(Main.java:668)
        at org.apache.tools.ant.Main.startAnt(Main.java:187)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)

Javascript is enabled to can store href parameter. It is right or not?
Should I change storeRegEx regular expression?=20
=BF?

Cheers, FJMartin.


AVISO LEGAL: La informacion contenida en este mensaje y cualquier documen=
to adjunto en el mismo es confidencial, puede estar legalmente protegida =
y esta dirigida solamente al destinatario. La publicacion, uso, distribuc=
ion, impresion o copia no autorizada del contenido de este mensaje, esta =
estrictamente prohibida y puede ser ilegal. Si Vd. ha recibido este mensa=
je 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 do=
cument is confidential, covered by law and intended solely for the recipi=
ent. 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.