This repository was archived by the owner on Apr 7, 2022. It is now read-only.
File tree Expand file tree Collapse file tree
jwebunit-htmlunit-plugin/src/main/java/net/sourceforge/jwebunit/htmlunit Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -399,15 +399,23 @@ public void gotoFrame(String frameNameOrId) {
399399 */
400400 @ Override
401401 public void setWorkingForm (int index ) {
402- setWorkingForm (getForm (index ));
402+ HtmlForm newForm = getForm (index );
403+ if (newForm == null ) {
404+ throw new UnableToSetFormException ("No form found in current page with index " + index );
405+ }
406+ setWorkingForm (newForm );
403407 }
404408
405409 /**
406410 * {@inheritDoc}
407411 */
408412 @ Override
409413 public void setWorkingForm (String nameOrId , int index ) {
410- setWorkingForm (getForm (nameOrId , index ));
414+ HtmlForm newForm = getForm (nameOrId , index );
415+ if (newForm == null ) {
416+ throw new UnableToSetFormException ("No form found in current page with name or id [" + nameOrId + "] and index " + index );
417+ }
418+ setWorkingForm (newForm );
411419 }
412420
413421 /**
@@ -1183,9 +1191,6 @@ protected HtmlPage getCurrentPage() {
11831191 }
11841192
11851193 private void setWorkingForm (HtmlForm newForm ) {
1186- if (newForm == null ) {
1187- throw new UnableToSetFormException ("Attempted to set form to null." );
1188- }
11891194 form = newForm ;
11901195 }
11911196
Original file line number Diff line number Diff line change 3131 </properties >
3232 <body >
3333 <release version =" 3.3" date =" UNKNOWN" description =" HtmlUnit 2.17, Java 7" >
34+ <action type =" fix" dev =" henryju" issue =" 135" due-to =" Joseph Walton" >
35+ Exception from setWorkingForm should indicate the requested form details.
36+ </action >
3437 <action type =" fix" dev =" henryju" issue =" 136" due-to =" Randy Chang" >
3538 Setting User-Agent not work when multiple WebTesters with different User-Agent.
3639 </action >
You can’t perform that action at this time.
0 commit comments