|
From: Elise L. <el...@ch...> - 2004-06-23 21:56:04
|
I'm evaluating htmlunit and am running into a pretty basic problem. I can't
submit a form that has a javascript action. Do I need to do some init for
JavaScript to work?
I am using 1.3pre and this is my code:
final WebClient webClient = new WebClient();
final URL url = new URL(url);
final HtmlPage page1 = (HtmlPage)webClient.getPage(url);
final List list = page1.getFrames();
final HtmlFrame frame2 = (HtmlFrame)list.get(1);
final HtmlPage test = (HtmlPage)frame2.getEnclosedPage();
test.getFormByName("myYear").submit();
this is the stack:
com.gargoylesoftware.htmlunit.ScriptException: DomNode has not been set for
this SimpleScriptable: com.gargoylesoftware.htmlunit.javascript.host.Select
at
com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.execute(JavaScript
Engine.java:264)
at
com.gargoylesoftware.htmlunit.html.HtmlPage.executeJavaScriptIfPossible(Html
Page.java:700)
at com.gargoylesoftware.htmlunit.html.HtmlForm.submit(HtmlForm.java:156)
at com.gargoylesoftware.htmlunit.html.HtmlForm.submit(HtmlForm.java:130)
at com.chrome.cudlpsg.CUDLWBTests.testModelSelector(CUDLWBTests.java:75)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at junit.textui.TestRunner.doRun(TestRunner.java:116)
at com.intellij.rt.execution.junit2.IdeaJUnitAgent.doRun(Unknown Source)
at junit.textui.TestRunner.start(TestRunner.java:172)
at
com.intellij.rt.execution.junit.TextTestRunner2.startRunnerWithArgs(Unknown
Source)
at
com.intellij.rt.execution.junit2.JUnitStarter.prepareStreamsAndStart(Unknown
Source)
at com.intellij.rt.execution.junit2.JUnitStarter.main(Unknown Source)
Elise Lebeau
Software Engineer
Chrome Systems Corporation
email: <mailto:me...@ch...> el...@ch...
phone: 503.963.6320
Fax: 503.963.6310
|