Revision: 471
Author: henryju
Date: 2006-06-05 07:16:53 -0700 (Mon, 05 Jun 2006)
ViewCVS: http://svn.sourceforge.net/jwebunit/?rev=471&view=rev
Log Message:
-----------
Fix bug with Javascript. Browser name should contain "Internet Explorer".
Add input type="button" in submit() method.
Modified Paths:
--------------
trunk/jwebunit-htmlunit-plugin/src/main/java/net/sourceforge/jwebunit/htmlunit/HtmlUnitDialog.java
Modified:
trunk/jwebunit-htmlunit-plugin/src/main/java/net/sourceforge/jwebunit/htmlunit/HtmlUnitDialog.java
===================================================================
---
trunk/jwebunit-htmlunit-plugin/src/main/java/net/sourceforge/jwebunit/htmlunit/HtmlUnitDialog.java
2006-06-05 11:19:08 UTC (rev 470)
+++
trunk/jwebunit-htmlunit-plugin/src/main/java/net/sourceforge/jwebunit/htmlunit/HtmlUnitDialog.java
2006-06-05 14:16:53 UTC (rev 471)
@@ -424,7 +424,7 @@
}
private void initWebClient() {
- wc = new WebClient(new BrowserVersion("htmlunit", "1.8", testContext
+ wc = new WebClient(new
BrowserVersion(BrowserVersion.INTERNET_EXPLORER, "4.0", testContext
.getUserAgent(), "1.2", 6));
wc.setJavaScriptEnabled(jsEnabled);
wc.setThrowExceptionOnScriptError(true);
@@ -761,8 +761,7 @@
public ClickableElement getButton(String buttonId) {
HtmlElement btn = null;
try {
- btn = ((HtmlPage) win.getEnclosedPage())
- .getHtmlElementById(buttonId);
+ btn = getCurrentPage().getHtmlElementById(buttonId);
} catch (ElementNotFoundException e) {
// Non trouv\xE9
return null;
@@ -916,14 +915,22 @@
for (int i=0; i<inpt.length; i++) {
if (inpt[i] instanceof HtmlSubmitInput) {
((HtmlSubmitInput) inpt[i]).click();
+ return;
}
}
+ for (int i=0; i<inpt.length; i++) {
+ if (inpt[i] instanceof HtmlButtonInput) {
+ ((HtmlButtonInput) inpt[i]).click();
+ return;
+ }
+ }
} catch (IOException e) {
throw new RuntimeException(
"HtmlUnit Error submitting form using default submit
button, "
+ "check that form has single submit button,
otherwise use submit(name): \n"
+ ExceptionUtility.stackTraceToString(e));
}
+ throw new RuntimeException("No submit button found in current form.");
}
/**
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
Jwebunit-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jwebunit-development