Update of /cvsroot/jwebunit//jWebUnit/src/net/sourceforge/jwebunit
In directory
sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv717/src/net/sourceforge/jwebunit
Modified Files:
HttpUnitDialog.java
Log Message:
adding find button functionality. incremental iteration for jwebunit
integration.
Index: HttpUnitDialog.java
===================================================================
RCS file:
/cvsroot/jwebunit//jWebUnit/src/net/sourceforge/jwebunit/HttpUnitDialog.java,v
retrieving revision 1.55
retrieving revision 1.56
diff -C2 -d -r1.55 -r1.56
*** HttpUnitDialog.java 22 Jul 2005 01:24:54 -0000 1.55
--- HttpUnitDialog.java 12 Aug 2005 18:21:49 -0000 1.56
***************
*** 512,529 ****
* @return <code>true</code> when the button with text could be found.
*/
! public boolean hasButtonWithText(String text) {
! Button[] buttons = getForm().getButtons();
! boolean found = false;
for (int i = 0; i < buttons.length; i++) {
Button button = buttons[i];
! if (button.getValue().equals(text)) {
! found = true;
break;
}
}
! return found;
}
!
/**
* Returns if the button identified by <code>buttonId</code> is present.
--- 512,534 ----
* @return <code>true</code> when the button with text could be found.
*/
! public boolean hasButtonByValue(String text) {
! boolean bReturn = getButtonByValue(text) != null ? true : false;
! return bReturn;
! }
! public Button getButtonByValue(String buttonValueText) {
! Button theButton = null;
! Button[] buttons = getForm().getButtons();
for (int i = 0; i < buttons.length; i++) {
Button button = buttons[i];
! if (button.getValue().equals(buttonValueText)) {
! theButton = button;
break;
}
}
! return theButton;
}
!
!
/**
* Returns if the button identified by <code>buttonId</code> is present.
***************
*** 1077,1080 ****
--- 1082,1097 ----
}
}
+
+ public void clickButtonWithText(String buttonValueText) {
+ try {
+ if(hasButtonByValue(buttonValueText)) {
+ getButtonByValue(buttonValueText).click();
+ resp = wc.getCurrentPage();
+ }
+ } catch (Exception e) {
+ throw new
RuntimeException(ExceptionUtility.stackTraceToString(e));
+ }
+ }
+
/**
-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Jwebunit-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jwebunit-development