[Webtest] stupid webtest question #426. Can I store a constan t for later us e?

Bill Milbratz webtest@lists.canoo.com
Mon, 29 Sep 2003 18:55:05 -0500


This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------=_NextPartTM-000-f44ea8a9-2c87-455e-b4ab-2b4e48e5de97
Content-Type: multipart/alternative;
	boundary="----_=_NextPart_001_01C386E5.1B45FC30"

------_=_NextPart_001_01C386E5.1B45FC30
Content-Type: text/plain;
	charset="iso-8859-1"

>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

 


------_=_NextPart_001_01C386E5.1B45FC30
Content-Type: text/html;
	charset="iso-8859-1"

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<TITLE>stupid webtest question #426. Can I store a constant for later use?</TITLE>

<META content="MSHTML 6.00.2800.1226" name=GENERATOR></HEAD>
<BODY>
<DIV><FONT face="Arial Unicode MS">
<DIV><SPAN class=383080908-26092003><FONT face=Arial><FONT color=#0000ff><FONT 
size=2><SPAN class=897375023-29092003>&gt;</SPAN>In our current project we have 
the very same issue.</FONT></FONT></FONT></SPAN></DIV>
<DIV><SPAN class=383080908-26092003><FONT face=Arial><FONT color=#0000ff><FONT 
size=2><SPAN class=897375023-29092003>&gt;</SPAN>You need to find an xpath 
expression that evaluates to your 'constant', eg. 
xpath="concat(''MYCONSTANT,'')"</FONT></FONT></FONT></SPAN></DIV></FONT></DIV>
<DIV><FONT face="Arial Unicode MS" color=#0000ff size=2></FONT>&nbsp;</DIV>
<DIV><SPAN class=897375023-29092003><FONT face="Arial Unicode MS" color=#0000ff 
size=2>This sounded good, but such a concat&nbsp; (and all combinations I tried) 
gave me the following errors. Any suggestions?</FONT></SPAN></DIV>
<DIV><SPAN class=897375023-29092003><FONT face="Arial Unicode MS" color=#0000ff 
size=2>e.g. these xpath's:</FONT></SPAN></DIV>
<DIV><SPAN class=897375023-29092003><FONT face=Arial color=#0000ff 
size=2>xpath="concat(''MYCONSTANT','')"</FONT></SPAN></DIV>
<DIV><SPAN class=897375023-29092003>
<DIV><SPAN class=897375023-29092003><FONT face=Arial color=#0000ff 
size=2>xpath="concat(//title,'MYCONSTANT')"</FONT></SPAN></DIV></SPAN></DIV>
<DIV><SPAN class=897375023-29092003><FONT face="Arial Unicode MS" color=#0000ff 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=897375023-29092003></SPAN><FONT face="Arial Unicode MS"><FONT 
color=#0000ff><FONT size=2>Y<SPAN class=897375023-29092003>ielded these such 
errors:</SPAN></FONT></FONT></FONT></DIV><FONT face="Arial Unicode MS"><FONT 
color=#0000ff><FONT size=2><SPAN 
class=897375023-29092003></SPAN></FONT></FONT></FONT><FONT 
face="Arial Unicode MS" color=#0000ff size=2></FONT><FONT 
face="Arial Unicode MS" color=#0000ff size=2></FONT><FONT 
face="Arial Unicode MS" color=#0000ff size=2></FONT>
<DIV><BR><FONT face="Arial Unicode MS" color=#0000ff size=2>&nbsp;[testSpec] 
org.dom4j.XPathException: Exception occurred evaluting XPath: The result of 
the<BR>XPath expression is not a Node. It was: a of type: java.lang.String. You 
might want to use a<BR>&nbsp;different method such as selectObject() to evaluate 
this XPath expression<BR>&nbsp;[testSpec]&nbsp;&nbsp;&nbsp;&nbsp; at 
org.dom4j.xpath.DefaultXPath.selectSingleNode(DefaultXPath.java:163)<BR>&nbsp;[testSpec]&nbsp;&nbsp;&nbsp;&nbsp; 
at 
org.dom4j.tree.AbstractNode.selectSingleNode(AbstractNode.java:188)<BR>&nbsp;[testSpec]&nbsp;&nbsp;&nbsp;&nbsp; 
at 
com.canoo.webtest.steps.StoreXPath.getXPath(StoreXPath.java:83)<BR>&nbsp;[testSpec]&nbsp;&nbsp;&nbsp;&nbsp; 
at 
com.canoo.webtest.steps.StoreXPath.doExecute(StoreXPath.java:58)<BR>&nbsp;[testSpec]&nbsp;&nbsp;&nbsp;&nbsp; 
at 
com.canoo.webtest.steps.Step.execute(Step.java:56)<BR>&nbsp;[testSpec]&nbsp;&nbsp;&nbsp;&nbsp; 
at 
com.canoo.webtest.engine.Engine.executeSteps(Engine.java:32)<BR>&nbsp;[testSpec]&nbsp;&nbsp;&nbsp;&nbsp; 
at 
com.canoo.webtest.ant.TestSpecificationTask.execute(TestSpecificationTask</FONT></DIV>
<DIV><FONT face="Arial Unicode MS" color=#0000ff size=2></FONT>&nbsp;</DIV>
<DIV><SPAN class=897375023-29092003><FONT face="Arial Unicode MS" color=#0000ff 
size=2>thanks,</FONT></SPAN></DIV>
<DIV><SPAN class=897375023-29092003><FONT face="Arial Unicode MS" color=#0000ff 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=897375023-29092003><FONT face="Arial Unicode MS" color=#0000ff 
size=2>bill m</FONT></SPAN></DIV>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
  <DIV class=OutlookMessageHeader dir=ltr align=left><FONT 
  face="Arial Unicode MS" color=#0000ff 
size=2></FONT>&nbsp;</DIV></BLOCKQUOTE></BODY></HTML>

------_=_NextPart_001_01C386E5.1B45FC30--

------=_NextPartTM-000-f44ea8a9-2c87-455e-b4ab-2b4e48e5de97--