Hi Franscisco
First, let me apologize for my previous answer.
I just meet these kind of things too often lately in a different
project :-(
let me try again
As I wrote, your regexp is wrong, as it looks for:
.*name="href".*href="javascript:eliminar(10101A, prueba marcos)"
and doesn't find anything.
I don't see where the part name="href" should match?
This should be sufficient (provided all the spaces are correct...):
href="javascript:eliminar(10101A, prueba marcos)"
As for the clickLink.
It looks like clickLink locate the link on the page, click on it and
nothing happens?
Maybe an issue with the java script called?
You may try to set in log4j.properties:
log4j.logger.com.gargoylesoftware.htmlunit=debug
I hope to be more helpful today ;-)
Best
dna
Message: 5
From: "Francisco Javier Martin Gutierrez"
<[EMAIL PROTECTED]>
To: <[email protected]>, <[email protected]>
Date: Wed, 30 May 2007 17:14:23 +0200
Organization: THALES
Subject: [Webtest] javascript link
Reply-To: [email protected]
Reply-To: <[EMAIL PROTECTED]>
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"href".*href=3D"javascript:eliminar
(10101=
A,
prueba marcos)""
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.
--
Defeat is not the worst of failures. Not to have tried is the true
failure.
-- George E. Woodberry
_______________________________________________
WebTest mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/webtest