[Webtest] [webtest][JIRA] Created: (WT-298) verifyElementText ElementNotFoundException inside "not"

Alex Curelea (JIRA) Alex Curelea (JIRA)" <noreply@canoo.com
Thu, 5 Apr 2007 21:43:33 +0200 (CEST)


verifyElementText ElementNotFoundException inside "not"
-------------------------------------------------------

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

    Versions: 2.1    
    Reporter: Alex Curelea


As per the mailing list:

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 tried using the following xpath, and I got the exact same behaviour and the same exception:
<not><verifyXPath xpath="id('topVerify')"/></not>

However, the following xpath, as suggested by Marc, works entirely as expected (the xpath step fails, the not step passes):
<not><verifyXPath xpath="//*[@id='topVerify']"/></not>

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



-- 
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