I am trying to to post a comment from a webpage.. Comment web page has textarea and a button type input
here is html of textarea
<textarea class="aui-field-input aui-field-input-text" id="_33_wgdr_postReplyBody0" name="_33_postReplyBody0" wrap="soft" style="height: 100px; width: 500px;"></textarea>
and here is the way I am writing some text into textarea
HtmlTextArea hta = (HtmlTextArea) commentPage.getElementsByName("_33_postReplyBody0").get(0);
hta.setAttribute("value", "This Is Generated Text");
Button input in html page is
<input class="aui-button-input" onclick="wgdr_postReply(0);" type="button" value="Reply" id="_33_wgdr_postReplyButton0"/>
I have tried to click on button in either this way
HtmlButtonInput hbi = (HtmlButtonInput) commentPage.getByXPath("//*[@value='Reply' and @type='button']").get(0);
HtmlPage test = hbi.click();
or this way
HtmlButtonInput hbi = (HtmlButtonInput) commentPage.getByXPath("//*[@value='Reply' and @type='button']").get(0);
String functName = hbi.getAttribute("onclick");
ScriptResult scriptResult = commentPage.executeJavaScript(functName);
as a result my webpage and thus database should have a new comment "This Is Generated Text" which is not the case at all... I have initialized my webclient in following way:
WebClient webClient = new WebClient(BrowserVersion.INTERNET_EXPLORER_8);
webClient.setJavaScriptEnabled(true);
webClient.setThrowExceptionOnScriptError(false);
webClient.setThrowExceptionOnFailingStatusCode(false);
webClient.setPrintContentOnFailingStatusCode(false);
webClient.setTimeout(60000);
webClient.setJavaScriptTimeout(60000);
webClient.waitForBackgroundJavaScript(10000);
I have been digging into this since two days with no fruitful outcomes...Please post your thoughts Thanks, -Asrar