I have following html page:
<html>
<head>
</body>
</html>
I enter some text to textarea and click button "Next":
WebClient client = new WebClient();
HtmlPage page = (HtmlPage)
client.getPage(new URL("file://c:\test.html"));
HtmlForm form =
page.getFormByName("item");
((HtmlTextArea)
form.getTextAreasByName("question").get(0)).setText
("some text");
form.getInputByName
("btn_submit").click();
I get followinf message:
WARNING: window.alert("false") no alert handler
installed.
But if I don't enter text to textarea and click "Next":
WebClient client = new WebClient();
HtmlPage page = (HtmlPage)
client.getPage(new URL("file://c:\test.html"));
HtmlForm form =
page.getFormByName("item");
form.getInputByName
("btn_submit").click();
I'll get another message:
WARNING: window.alert("1") no alert handler installed
And this is correct message, I think.
What is wrong? Why filling text influenses on my button?
test html page
Logged In: YES
user_id=402164
it would help if you say where it doesn't run correctly and
what is the result that a real browser delivers.
Logged In: YES
user_id=1180044
Real browser(I checked for Internet Explorer 6.0 and Mozilla
1.7.3) delivers: window.alert("1") . I think that it's correct.
Logged In: YES
user_id=402164
in both cases? In your description, you present 2 cases and
I fail to understand what is wrong.
Logged In: YES
user_id=1180044
Browsers perform window.alert("1") whether I enter text to
text area or no. But htmlunit gives two different results:
window.alert("1") if I enter some text to text area,
window.alert("false") if I don't enter text to textarea.
Logged In: YES
user_id=402164
Ok, now I understand.
I've now got a minimal test illustrating the problem (it
throws a ScriptException in htmlunit), but not found the
cause of the problem yet:
<html>
<head>
</head>
<body>
<form name="form1">
<textarea name="question"></textarea>
<input type="button" name="btn_submit" value="Next">
</form> <script language="JavaScript"> document.form1.question.value = "some text"; alert("0: " + document.form1.elements[0].tagName); alert("1: " + document.form1.elements[1].tagName); </script>
</body>
</html>
Logged In: YES
user_id=402164
Should now be fixed in cvs.
The problem was in the textarea DOM node: changing the text
corrupted the dom tree (btw I've fixed the same problem
concerning document's title).