--- Begin Message ---
storeXPath() fails with version 2.6
-----------------------------------

         Key: WT-408
         URL: http://webtest-community.canoo.com/jira/browse/WT-408
     Project: WebTest
        Type: Bug

    Versions: 2.6    
 Environment: Debian lenny on 2.6.24.3 Linux Kernel
JDK 1.6.0_10
Groovy 1.5.1
    Reporter: Florent Blondeau
 Attachments: jaxenexception.html, jaxenexception_test.groovy

I'm facing a problem that didn't appear with the last version I used (2.5)

I have a storeXPath() step (sorry for the method formulation, but I'm using 
groooooovy) that works really well with the 2.5 version.
I use the same script with an other webtest path (which points to the 2.6)

My 53th step raise this exception (I put only the relevant information that 
doesn't come from the webtest exception treatment):

<error exception="com.canoo.webtest.engine.StepExecutionException" 
message="Unexpected exception caught: java.lang.NullPointerException">
                <antStack>
                    <call filename="" line="0"/>
                </antStack>
                <stacktrace><![CDATA[: Unexpected exception caught:
--- Nested Exception ---
java.lang.NullPointerException
    at org.jaxen.function.ContainsFunction.evaluate(ContainsFunction.java:131)
    at org.jaxen.function.ContainsFunction.call(ContainsFunction.java:100)
    at 
org.jaxen.expr.DefaultFunctionCallExpr.evaluate(DefaultFunctionCallExpr.java:177)
    at org.jaxen.expr.DefaultPredicate.evaluate(DefaultPredicate.java:95)
    at org.jaxen.expr.PredicateSet.applyPredicate(PredicateSet.java:269)
    at org.jaxen.expr.PredicateSet.evaluatePredicates(PredicateSet.java:244)
    at org.jaxen.expr.DefaultNameStep.evaluate(DefaultNameStep.java:291)
    at org.jaxen.expr.DefaultLocationPath.evaluate(DefaultLocationPath.java:140)
    at 
org.jaxen.expr.DefaultAbsoluteLocationPath.evaluate(DefaultAbsoluteLocationPath.java:113)
    at org.jaxen.expr.DefaultXPathExpr.asList(DefaultXPathExpr.java:102)
    at org.jaxen.BaseXPath.selectNodesForContext(BaseXPath.java:674)
    at org.jaxen.BaseXPath.selectSingleNodeForContext(BaseXPath.java:698)
    at org.jaxen.BaseXPath.stringValueOf(BaseXPath.java:279)
    at 
com.canoo.webtest.steps.store.StoreXPath.evaluateXPath(StoreXPath.java:72)
    at com.canoo.webtest.steps.store.StoreXPath.doExecute(StoreXPath.java:68)
    at com.canoo.webtest.steps.Step.execute(Step.java:101)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
    at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
    at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at 
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    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:101)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at 
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at com.canoo.webtest.ant.WebtestTask.execute(WebtestTask.java:206)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at 
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at groovy.util.AntBuilder.nodeCompleted(AntBuilder.java:178)
    at groovy.util.BuilderSupport.doInvokeMethod(BuilderSupport.java:153)
    at groovy.util.AntBuilder.doInvokeMethod(AntBuilder.java:132)
    at groovy.util.BuilderSupport.invokeMethod(BuilderSupport.java:64)
    at 
org.codehaus.groovy.runtime.InvokerHelper.invokePogoMethod(InvokerHelper.java:777)
    at 
org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:753)
    at 
org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodN(ScriptBytecodeAdapter.java:167)
    at com.pingwy.groovy.tests.Webtest_GMF.run(Webtest_GMF.groovy:98)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:95)
    at 
org.codehaus.groovy.runtime.MetaClassHelper.doMethodInvoke(MetaClassHelper.java:599)
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:904)
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:740)
    at 
org.codehaus.groovy.runtime.InvokerHelper.invokePogoMethod(InvokerHelper.java:773)
    at 
org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:753)
    at 
org.codehaus.groovy.runtime.InvokerHelper.runScript(InvokerHelper.java:402)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:95)
    at 
org.codehaus.groovy.runtime.MetaClassHelper.doMethodInvoke(MetaClassHelper.java:599)
    at groovy.lang.MetaClassImpl.invokeStaticMethod(MetaClassImpl.java:1077)
    at 
org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:744)
    at 
org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodN(ScriptBytecodeAdapter.java:167)
    at com.mycompany.groovy.tests.Webtest.main(Webtest.groovy)
]]></stacktrace>
            </error>

It seems to come from Jaxen contains() evaluation within the xpath which is
storeXPath(xpath: 
"//td[contains(child::text(),'Webtest')]/following-sibling::td[position()=2]/child::text()",
 property:"webtest")

I've found something interesting. You can see the minimal html that rise the 
exception attached.
There is an HTML comment line 20. If I delete this comment, the script doesn't 
raise any exception and retreive the good value

Hope that helps to improve webtest ;-)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://webtest-community.canoo.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


--- End Message ---

Reply via email to