[Webtest] Re: verifyElementText ElementNotFoundException inside "not"

Marc Guillemot Marc Guillemot <mguillemot@yahoo.fr>
Thu, 05 Apr 2007 09:22:07 +0200


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="//*[@id='topApprove']" .../>? Correct? Seems strange
to me, I have to check.

Marc.

Curelea, Alex wrote:
> Hi all,
> 
>  
> 
> I sent this email yesterday but it seems to have got lost, so my
> apologies if it ends up posted twice.
> 
>  
> 
> I have the following code:
> 
>  
> 
> <not><verifyElementText htmlId="topApprove" text="(?i:Approve)"
> regex="true"/></not>
> 
>  
> 
> When the link is there, the page has <a id=”topApprove”
> href=”whatever”>Approve</a> -- in this case, I’m checking that the link
> is not on the page.
> 
>  
> 
> 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.
> 
>  
> 
> I also tried using an xpath instead of verifyElementText – I get the
> exact same exception.
> 
>  
> 
> Any ideas?
> 
>  
> 
> Thanks,
> 
>  
> 
> Alex
> 
>  
> 
> Exception
> 
> com.canoo.webtest.engine.StepExecutionException
> 
> Message
> 
> Unexpected exception caught:
> com.gargoylesoftware.htmlunit.ElementNotFoundException: elementName=[*]
> attributeName=[id] attributeValue=[topApprove]
> 
> Stacktrace
> 
> com.canoo.webtest.engine.StepExecutionException: Unexpected exception
> caught: com.gargoylesoftware.htmlunit.ElementNotFoundException:
> elementName=[*] attributeName=[id] attributeValue=[topApprove], Step:
> VerifyElementText at
> C:\WORK\tsm\canoo\webtests\modules\selfsched_clinical\buttons_creator_tentative.xml:7: 
> with (taskName="verifyElementText")
> 
>             at
> com.canoo.webtest.steps.Step.handleUnexpectedException(Step.java:413)
> 
>             at com.canoo.webtest.steps.Step.execute(Step.java:109)
> 
>             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.control.NotStep.doExecute(NotStep.java:46)
> 
>             at com.canoo.webtest.steps.Step.execute(Step.java:106)
> 
>             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:106)
> 
>             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:106)
> 
>             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.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:37)
> 
>             at
> org.apache.tools.ant.Project.executeTargets(Project.java:1068)
> 
>             at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:382)
> 
>             at org.apache.tools.ant.Task.perform(Task.java:364)
> 
>             at groovy.util.AntBuilder.nodeCompleted(AntBuilder.java:126)
> 
>             at
> groovy.util.BuilderSupport.doInvokeMethod(BuilderSupport.java:175)
> 
>             at
> groovy.util.BuilderSupport.invokeMethod(BuilderSupport.java:86)
> 
>             at
> org.codehaus.groovy.runtime.Invoker.invokeMethod(Invoker.java:161)
> 
>             at
> org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:104)
> 
>             at
> org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethod(ScriptBytecodeAdapter.java:85)
> 
>             at Script1.run(Script1.groovy:9)
> 
>             at org.codehaus.groovy.ant.Groovy.execGroovy(Groovy.java:455)
> 
>             at org.codehaus.groovy.ant.Groovy.execute(Groovy.java:349)
> 
>             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)
> 
> Caused by: com.gargoylesoftware.htmlunit.ElementNotFoundException:
> elementName=[*] attributeName=[id] attributeValue=[topApprove]
> 
>             at
> com.gargoylesoftware.htmlunit.html.HtmlPage.getHtmlElementById(HtmlPage.java:1310)
> 
>             at
> com.gargoylesoftware.htmlunit.html.HtmlElement.getHtmlElementById(HtmlElement.java:447)
> 
>             at
> com.canoo.webtest.steps.verify.VerifyElementText.doExecute(VerifyElementText.java:66)
> 
>             at com.canoo.webtest.steps.Step.execute(Step.java:106)
> 
>             ... 48 more
> 
>  
> 
>  
>