[Webtest] verifyXPath troubles

Marc Guillemot Marc Guillemot <mguillemot@yahoo.fr>
Tue, 24 Apr 2007 12:34:16 +0200


Hi Karel,

the XPath engine (Jaxen) is now stricter and complains about incorrect 
xpath expressions it previously accepted.
In your case, it seems to me that the closing parenthese for contains is 
missing.

Marc.

Karel Šoupal wrote:
> Hi,
> 
> I am experiencing strange behavior with the verifyXPath step. Checking 
> the table for a string I need to parse the string in the xml file .. so 
> the code looks there like this:
> 
> <verifyxpath description="table check" 
> xpath="//table[@id='users']//tr[(((#{newnumber}-1)*4)+#{count}+4)]/td[1][contains(string(),'#{newnumber}varloB#{count}@127.0.0.1']" 
> />
> 
> then in results the xpath parses like this:
> 
> //table[@id='users']//tr[(((1-1)*4)+0+4)]/td[1][contains(string(),'1varloB0@127.0.0.1'] 
> 
> 
> This syntax certainly worked on the version some time ago (cca 2005 .. 
> another question would be how to tell the exact build of the 
> distribution .. I have the old sources still on my backup)
> but now with R_1393 does not work and gives me this exception:
> 
> Error Message: org.jaxen.XPathSyntaxException cannot be cast to 
> java.lang.RuntimeException
> Location: (line: )
> Exception: java.lang.ClassCastException
>  Stacktrace java.lang.ClassCastException: org.jaxen.XPathSyntaxException 
> cannot be cast to java.lang.RuntimeException
>     at 
> com.canoo.webtest.steps.AbstractStepContainer.executeContainedStep(AbstractStepContainer.java:79) 
> 
>     at 
> com.canoo.webtest.steps.AbstractStepContainer.executeContainedSteps(AbstractStepContainer.java:91) 
> 
>     at 
> com.canoo.webtest.steps.control.GroupStep.doExecute(GroupStep.java:14)
>     at 
> com.canoo.webtest.steps.control.MultipleExecutionStepContainer$ProxiesResettingGroupStep.doExecute(MultipleExecutionStepContainer.java:39) 
> 
>     at com.canoo.webtest.steps.Step.execute(Step.java:104)
>     at org.apache.tools.ant.Task.perform(Task.java:364)
>     at 
> com.canoo.webtest.steps.control.RepeatStep.executeContainedTasks(RepeatStep.java:205) 
> 
>     at 
> com.canoo.webtest.steps.control.RepeatStep.doExecute(RepeatStep.java:159)
>     at com.canoo.webtest.steps.Step.execute(Step.java:104)
>     at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
>     at org.apache.tools.ant.Task.perform(Task.java:364)
>     at 
> com.canoo.webtest.steps.AbstractStepContainer.executeContainedStep(AbstractStepContainer.java:74) 
> 
>     at 
> com.canoo.webtest.steps.AbstractStepContainer.executeContainedSteps(AbstractStepContainer.java:91) 
> 
>     at 
> com.canoo.webtest.steps.control.GroupStep.doExecute(GroupStep.java:14)
>     at com.canoo.webtest.steps.Step.execute(Step.java:104)
>     at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
>     at org.apache.tools.ant.Task.perform(Task.java:364)
>     at 
> com.canoo.webtest.steps.AbstractStepContainer.executeContainedStep(AbstractStepContainer.java:74) 
> 
>     at 
> com.canoo.webtest.steps.AbstractStepContainer.executeContainedSteps(AbstractStepContainer.java:91) 
> 
>     at 
> com.canoo.webtest.steps.control.GroupStep.doExecute(GroupStep.java:14)
>     at com.canoo.webtest.steps.Step.execute(Step.java:104)
>     at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
>     at org.apache.tools.ant.Task.perform(Task.java:364)
>     at 
> com.canoo.webtest.steps.AbstractStepContainer.executeContainedStep(AbstractStepContainer.java:74) 
> 
>     at 
> com.canoo.webtest.steps.AbstractStepContainer.executeContainedSteps(AbstractStepContainer.java:91) 
> 
>     at 
> com.canoo.webtest.steps.control.GroupStep.doExecute(GroupStep.java:14)
>     at 
> com.canoo.webtest.steps.control.MultipleExecutionStepContainer$ProxiesResettingGroupStep.doExecute(MultipleExecutionStepContainer.java:39) 
> 
>     at com.canoo.webtest.steps.Step.execute(Step.java:104)
>     at org.apache.tools.ant.Task.perform(Task.java:364)
>     at 
> com.canoo.webtest.steps.control.RepeatStep.executeContainedTasks(RepeatStep.java:205) 
> 
>     at 
> com.canoo.webtest.steps.control.RepeatStep.doExecute(RepeatStep.java:159)
>     at com.canoo.webtest.steps.Step.execute(Step.java:104)
>     at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
>     at org.apache.tools.ant.Task.perform(Task.java:364)
>     at 
> com.canoo.webtest.ant.TestStepSequence.executeSteps(TestStepSequence.java:43) 
> 
>     at 
> com.canoo.webtest.ant.TestStepSequence.doExecute(TestStepSequence.java:31)
>     at com.canoo.webtest.steps.Step.execute(Step.java:104)
>     at org.apache.tools.ant.Task.perform(Task.java:364)
>     at com.canoo.webtest.ant.WebtestTask.execute(WebtestTask.java:164)
>     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(DefaultExecutor.java: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)
> 
> Any help deeply appreciated!
> 
> --Karel Soupal
> _______________________________________________
> WebTest mailing list
> WebTest@lists.canoo.com
> http://lists.canoo.com/mailman/listinfo/webtest
>