[Webtest] Re: verifyElementText ElementNotFoundException inside "not"

Curelea, Alex Curelea, Alex" <acurelea@otn.ca
Thu, 5 Apr 2007 15:45:24 -0400


Well, I think my xpath was wrong - the one I was using did give the same
exception, but the one you suggested works as I would expect.  So I have
a workaround :)

At any rate, I opened a bug report here:

http://webtest-community.canoo.com/jira/browse/WT-298

Thanks,

Alex

-----Original Message-----
From: webtest-admin@lists.canoo.com
[mailto:webtest-admin@lists.canoo.com] On Behalf Of Marc Guillemot
Sent: Thursday, April 05, 2007 3:22 AM
To: webtest@lists.canoo.com
Subject: [Webtest] Re: verifyElementText ElementNotFoundException inside
"not"

This is clearly a bug. Can you open an issue for it?

You say that you get the same exception using something like
<verifyXPath xpath=3D"//*[@id=3D'topApprove']" .../>? Correct? Seems =
strange
to me, I have to check.

Marc.

Curelea, Alex wrote:
> Hi all,
>=20
> =20
>=20
> I sent this email yesterday but it seems to have got lost, so my
> apologies if it ends up posted twice.
>=20
> =20
>=20
> I have the following code:
>=20
> =20
>=20
> <not><verifyElementText htmlId=3D"topApprove" text=3D"(?i:Approve)"
> regex=3D"true"/></not>
>=20
> =20
>=20
> When the link is there, the page has <a id=3D"topApprove"
> href=3D"whatever">Approve</a> -- in this case, I'm checking that the
link
> is not on the page.
>=20
> =20
>=20
> The verifyElementText fails - which is fine, since the element is not
> there - but the surprising part is that the "not" step also fails.
The
> report shows the exception below.
>=20
> =20
>=20
> I also tried using an xpath instead of verifyElementText - I get the
> exact same exception.
>=20
> =20
>=20
> Any ideas?
>=20
> =20
>=20
> Thanks,
>=20
> =20
>=20
> Alex
>=20
> =20
>=20
> Exception
>=20
> com.canoo.webtest.engine.StepExecutionException
>=20
> Message
>=20
> Unexpected exception caught:
> com.gargoylesoftware.htmlunit.ElementNotFoundException:
elementName=3D[*]
> attributeName=3D[id] attributeValue=3D[topApprove]
>=20
> Stacktrace
>=20
> com.canoo.webtest.engine.StepExecutionException: Unexpected exception
> caught: com.gargoylesoftware.htmlunit.ElementNotFoundException:
> elementName=3D[*] attributeName=3D[id] attributeValue=3D[topApprove], =
Step:
> VerifyElementText at
>
C:\WORK\tsm\canoo\webtests\modules\selfsched_clinical\buttons_creator_te
ntative.xml:7:=20
> with (taskName=3D"verifyElementText")
>=20
>             at
> com.canoo.webtest.steps.Step.handleUnexpectedException(Step.java:413)
>=20
>             at com.canoo.webtest.steps.Step.execute(Step.java:109)
>=20
>             at
> org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
>=20
>             at org.apache.tools.ant.Task.perform(Task.java:364)
>=20
>             at
>
com.canoo.webtest.steps.AbstractStepContainer.executeContainedStep(Abstr
actStepContainer.java:74)
>=20
>             at
> com.canoo.webtest.steps.control.NotStep.doExecute(NotStep.java:46)
>=20
>             at com.canoo.webtest.steps.Step.execute(Step.java:106)
>=20
>             at
> org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
>=20
>             at org.apache.tools.ant.Task.perform(Task.java:364)
>=20
>             at
>
com.canoo.webtest.steps.AbstractStepContainer.executeContainedStep(Abstr
actStepContainer.java:74)
>=20
>             at
>
com.canoo.webtest.steps.AbstractStepContainer.executeContainedSteps(Abst
ractStepContainer.java:91)
>=20
>             at
> com.canoo.webtest.steps.control.GroupStep.doExecute(GroupStep.java:14)
>=20
>             at com.canoo.webtest.steps.Step.execute(Step.java:106)
>=20
>             at
> org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
>=20
>             at org.apache.tools.ant.Task.perform(Task.java:364)
>=20
>             at
>
com.canoo.webtest.ant.TestStepSequence.executeSteps(TestStepSequence.jav
a:43)
>=20
>             at
>
com.canoo.webtest.ant.TestStepSequence.doExecute(TestStepSequence.java:3
1)
>=20
>             at com.canoo.webtest.steps.Step.execute(Step.java:106)
>=20
>             at org.apache.tools.ant.Task.perform(Task.java:364)
>=20
>             at
> com.canoo.webtest.ant.WebtestTask.execute(WebtestTask.java:164)
>=20
>             at
> org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
>=20
>             at org.apache.tools.ant.Task.perform(Task.java:364)
>=20
>             at org.apache.tools.ant.Target.execute(Target.java:341)
>=20
>             at
org.apache.tools.ant.Target.performTasks(Target.java:369)
>=20
>             at
> org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
>=20
>             at
>
org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleChe
ckExecutor.java:37)
>=20
>             at
> org.apache.tools.ant.Project.executeTargets(Project.java:1068)
>=20
>             at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:382)
>=20
>             at org.apache.tools.ant.Task.perform(Task.java:364)
>=20
>             at
groovy.util.AntBuilder.nodeCompleted(AntBuilder.java:126)
>=20
>             at
> groovy.util.BuilderSupport.doInvokeMethod(BuilderSupport.java:175)
>=20
>             at
> groovy.util.BuilderSupport.invokeMethod(BuilderSupport.java:86)
>=20
>             at
> org.codehaus.groovy.runtime.Invoker.invokeMethod(Invoker.java:161)
>=20
>             at
>
org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.jav
a:104)
>=20
>             at
>
org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethod(ScriptByt
ecodeAdapter.java:85)
>=20
>             at Script1.run(Script1.groovy:9)
>=20
>             at
org.codehaus.groovy.ant.Groovy.execGroovy(Groovy.java:455)
>=20
>             at org.codehaus.groovy.ant.Groovy.execute(Groovy.java:349)
>=20
>             at
> org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
>=20
>             at org.apache.tools.ant.Task.perform(Task.java:364)
>=20
>             at org.apache.tools.ant.Target.execute(Target.java:341)
>=20
>             at
org.apache.tools.ant.Target.performTasks(Target.java:369)
>=20
>             at
> org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
>=20
>             at
org.apache.tools.ant.Project.executeTarget(Project.java:1185)
>=20
>             at
>
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecut
or.java:40)
>=20
>             at
> org.apache.tools.ant.Project.executeTargets(Project.java:1068)
>=20
>             at org.apache.tools.ant.Main.runBuild(Main.java:668)
>=20
>             at org.apache.tools.ant.Main.startAnt(Main.java:187)
>=20
>             at
org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
>=20
>             at
org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)
>=20
> Caused by: com.gargoylesoftware.htmlunit.ElementNotFoundException:
> elementName=3D[*] attributeName=3D[id] attributeValue=3D[topApprove]
>=20
>             at
>
com.gargoylesoftware.htmlunit.html.HtmlPage.getHtmlElementById(HtmlPage.
java:1310)
>=20
>             at
>
com.gargoylesoftware.htmlunit.html.HtmlElement.getHtmlElementById(HtmlEl
ement.java:447)
>=20
>             at
>
com.canoo.webtest.steps.verify.VerifyElementText.doExecute(VerifyElement
Text.java:66)
>=20
>             at com.canoo.webtest.steps.Step.execute(Step.java:106)
>=20
>             ... 48 more
>=20
> =20
>=20
> =20
>=20

_______________________________________________
WebTest mailing list
WebTest@lists.canoo.com
http://lists.canoo.com/mailman/listinfo/webtest