[Webtest] stupid webtest question #426. Can I store a constant

Christopher Painter-Wakefield webtest@lists.canoo.com
Tue, 30 Sep 2003 11:24:11 -0400


This is a multipart message in MIME format.
--=_alternative 0054A6E985256DB1_=
Content-Type: text/plain; charset="us-ascii"

This should be an easy fix, but while you are waiting, perhaps there are 
some workarounds.  One thing I don't understand is  why or if you need to 
do a concatenation?  Can you just do xpath="//title"?  That will avoid 
this bug.

-Christopher





webtest-request@gate.canoo.com
Sent by: webtest-admin@gate.canoo.com
09/30/2003 10:34 AM
Please respond to webtest

 
        To:     webtest@gate.canoo.com
        cc: 
        Subject:        WebTest digest, Vol 1 #382 - 4 msgs


>In our current project we have the very same issue.
>You need to find an xpath expression that evaluates to your 'constant', 
eg.
xpath="concat(''MYCONSTANT,'')"
 
This sounded good, but such a concat  (and all combinations I tried) gave 
me
the following errors. Any suggestions?
e.g. these xpath's:
xpath="concat(''MYCONSTANT','')"

xpath="concat(//title,'MYCONSTANT')"
 
Yielded these such errors:


 [testSpec] org.dom4j.XPathException: Exception occurred evaluting XPath:
The result of the
XPath expression is not a Node. It was: a of type: java.lang.String. You
might want to use a
 different method such as selectObject() to evaluate this XPath expression
 [testSpec]     at
org.dom4j.xpath.DefaultXPath.selectSingleNode(DefaultXPath.java:163)
 [testSpec]     at
org.dom4j.tree.AbstractNode.selectSingleNode(AbstractNode.java:188)
 [testSpec]     at
com.canoo.webtest.steps.StoreXPath.getXPath(StoreXPath.java:83)
 [testSpec]     at
com.canoo.webtest.steps.StoreXPath.doExecute(StoreXPath.java:58)
 [testSpec]     at com.canoo.webtest.steps.Step.execute(Step.java:56)
 [testSpec]     at
com.canoo.webtest.engine.Engine.executeSteps(Engine.java:32)
 [testSpec]     at
com.canoo.webtest.ant.TestSpecificationTask.execute(TestSpecificationTask
 
thanks,
 
bill m

--=_alternative 0054A6E985256DB1_=
Content-Type: text/html; charset="us-ascii"


<br><font size=2 face="sans-serif">This should be an easy fix, but while you are waiting, perhaps there are some workarounds. &nbsp;One thing I don't understand is &nbsp;why or if you need to do a concatenation? &nbsp;Can you just do xpath=&quot;//title&quot;? &nbsp;That will avoid this bug.</font>
<br>
<br><font size=2 face="sans-serif">-Christopher</font>
<br>
<br>
<br>
<br>
<table width=100%>
<tr valign=top>
<td>
<td><font size=1 face="sans-serif"><b>webtest-request@gate.canoo.com</b></font>
<br><font size=1 face="sans-serif">Sent by: webtest-admin@gate.canoo.com</font>
<p><font size=1 face="sans-serif">09/30/2003 10:34 AM</font>
<br><font size=1 face="sans-serif">Please respond to webtest</font>
<br>
<td><font size=1 face="Arial">&nbsp; &nbsp; &nbsp; &nbsp; </font>
<br><font size=1 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; To: &nbsp; &nbsp; &nbsp; &nbsp;webtest@gate.canoo.com</font>
<br><font size=1 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; cc: &nbsp; &nbsp; &nbsp; &nbsp;</font>
<br><font size=1 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; Subject: &nbsp; &nbsp; &nbsp; &nbsp;WebTest digest, Vol 1 #382 - 4 msgs</font></table>
<br>
<br>
<br><font size=2 face="Courier New">&gt;In our current project we have the very same issue.<br>
&gt;You need to find an xpath expression that evaluates to your 'constant', eg.<br>
xpath=&quot;concat(''MYCONSTANT,'')&quot;<br>
 <br>
This sounded good, but such a concat &nbsp;(and all combinations I tried) gave me<br>
the following errors. Any suggestions?<br>
e.g. these xpath's:<br>
xpath=&quot;concat(''MYCONSTANT','')&quot;<br>
<br>
xpath=&quot;concat(//title,'MYCONSTANT')&quot;<br>
 <br>
Yielded these such errors:<br>
<br>
<br>
 [testSpec] org.dom4j.XPathException: Exception occurred evaluting XPath:<br>
The result of the<br>
XPath expression is not a Node. It was: a of type: java.lang.String. You<br>
might want to use a<br>
 different method such as selectObject() to evaluate this XPath expression<br>
 [testSpec] &nbsp; &nbsp; at<br>
org.dom4j.xpath.DefaultXPath.selectSingleNode(DefaultXPath.java:163)<br>
 [testSpec] &nbsp; &nbsp; at<br>
org.dom4j.tree.AbstractNode.selectSingleNode(AbstractNode.java:188)<br>
 [testSpec] &nbsp; &nbsp; at<br>
com.canoo.webtest.steps.StoreXPath.getXPath(StoreXPath.java:83)<br>
 [testSpec] &nbsp; &nbsp; at<br>
com.canoo.webtest.steps.StoreXPath.doExecute(StoreXPath.java:58)<br>
 [testSpec] &nbsp; &nbsp; at com.canoo.webtest.steps.Step.execute(Step.java:56)<br>
 [testSpec] &nbsp; &nbsp; at<br>
com.canoo.webtest.engine.Engine.executeSteps(Engine.java:32)<br>
 [testSpec] &nbsp; &nbsp; at<br>
com.canoo.webtest.ant.TestSpecificationTask.execute(TestSpecificationTask<br>
 <br>
thanks,<br>
 <br>
bill m</font>
<br>
--=_alternative 0054A6E985256DB1_=--