2 messages in com.canoo.lists.webtest[Webtest] [webtest][JIRA] Closed: (WT...
FromSent OnAttachments
Jake Newren (JIRA)21 Jul 2005 15:02 
Paul King (JIRA)19 Dec 2005 14:11 
Subject:[Webtest] [webtest][JIRA] Closed: (WT-69) setSelectField crashes app when trying to select an <option> tag that has no value attribute
From:Paul King (JIRA) (dier@canoo.com)
Date:12/19/2005 02:11:52 PM
List:com.canoo.lists.webtest

[ http://webtest-community.canoo.com/jira/browse/WT-69?page=history ]

Paul King closed WT-69: -----------------------

Appears fixed

setSelectField crashes app when trying to select an <option> tag that has no
value attribute
--------------------------------------------------------------------------------------------

Key: WT-69 URL: http://webtest-community.canoo.com/jira/browse/WT-69 Project: WebTest Type: Bug Versions: 1.7 Reporter: Jake Newren Assignee: Paul King Fix For: 1.7

When attempting to process a web page, WebTest crashes when it comes to an
<option> tag that has no value attribute. Apparently htmlunit is unable to
handle an <option> tag without an accompanying value attribute. When attempting
to setSelectField it threw this exception: [testSpec] (steps.Step 181 ) Start Step: setselectfield "" (22/52) [testSpec] (steps.Step 374 ) Exception thrown from this class:
com.gargoylesoftware.htmlunit.ElementNotFoundException [testSpec] (steps.Step 376 ) Message was: elementName=[option]
attributeName=[value] attributeValue=[Visa] [testSpec] (steps.Step 387 ) Cannot handle unexpected exception in step
SetSelectField at C:\Documents and Settings\Administ rator\Desktop\webTestTrialRun.xml:66: with (multiselect="false", value="Visa",
description="", name="cardType", regex="false", stepType="setselectfie ld") [testSpec] com.gargoylesoftware.htmlunit.ElementNotFoundException:
elementName=[option] attributeName=[value] attributeValue=[Visa] [testSpec] at
com.gargoylesoftware.htmlunit.html.HtmlElement.getOneHtmlElementByAttribute(HtmlElement.java:451) [testSpec] at
com.gargoylesoftware.htmlunit.html.HtmlSelect.getOptionByValue(HtmlSelect.java:465) [testSpec] at
com.canoo.webtest.steps.form.SetSelectField.findMatchingOption(SetSelectField.java:109) [testSpec] at
com.canoo.webtest.steps.form.SetSelectField.updateField(SetSelectField.java:72) [testSpec] at
com.canoo.webtest.steps.form.AbstractSetNamedFieldStep.findThenSetField(AbstractSetNamedFieldStep.java:34) [testSpec] at
com.canoo.webtest.steps.form.AbstractSetFieldStep.doExecute(AbstractSetFieldStep.java:82) [testSpec] at com.canoo.webtest.steps.Step.execute(Step.java:96) [testSpec] at com.canoo.webtest.engine.Engine.executeSteps(Engine.java:30) [testSpec] at
com.canoo.webtest.ant.TestSpecificationTask.execute(TestSpecificationTask.java:67) [testSpec] at
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275) [testSpec] at org.apache.tools.ant.Task.perform(Task.java:364) [testSpec] at org.apache.tools.ant.Target.execute(Target.java:341) [testSpec] at org.apache.tools.ant.Target.performTasks(Target.java:369) [testSpec] at
org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216) [testSpec] at org.apache.tools.ant.Project.executeTarget(Project.java:1185) [testSpec] at
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40) [testSpec] at org.apache.tools.ant.Project.executeTargets(Project.java:1068) [testSpec] at org.apache.tools.ant.Main.runBuild(Main.java:668) [testSpec] at org.apache.tools.ant.Main.startAnt(Main.java:187) [testSpec] at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246) [testSpec] at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67) [testSpec] (ant.TestSpecificationTask 150 ) Writing report using Report class:
com.canoo.webtest.reporting.XmlReporter [testSpec] (ant.TestSpecificationTask 166 ) Test summary successfully created. BUILD FAILED C:\Documents and Settings\Administrator\Desktop\webTestTrialRun.xml:22: Test
failed. Exception raised: com.canoo.webtest.engine.StepExecutionException: Unexpected
exception caught: com.gargoylesoftware.htmlunit.ElementNotFoundException : elementName=[option] attributeName=[value] attributeValue=[Visa], Step:
SetSelectField at C:\Documents and Settings\Administrator\Desktop\webTestTri alRun.xml:66: with (multiselect="false", value="Visa", description="",
name="cardType", regex="false", stepType="setselectfield")com.canoo.webtest.en gine.StepExecutionException: Unexpected exception caught:
com.gargoylesoftware.htmlunit.ElementNotFoundException: elementName=[option]
attributeName=[ value] attributeValue=[Visa], Step: SetSelectField at C:\Documents and
Settings\Administrator\Desktop\webTestTrialRun.xml:66: with (multiselect="fals e", value="Visa", description="", name="cardType", regex="false",
stepType="setselectfield") at com.canoo.webtest.steps.Step.handleUnexpectedException(Step.java:388) at com.canoo.webtest.steps.Step.execute(Step.java:99) at com.canoo.webtest.engine.Engine.executeSteps(Engine.java:30) at
com.canoo.webtest.ant.TestSpecificationTask.execute(TestSpecificationTask.java:67) 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) The relevant HTML that was causing the issue: <select name="cardType" class="selectBox"> <option></option> <option></option> <option>Visa</option> <option value='MasterCard'>Master Card</option> <option value='AmericanExpress'>American Express</option> <option value='DinersClub'>Diners Club</option> <option>Discover</option> <option>EnRoute</option> <option>JCB</option> </select>