4 messages in com.canoo.lists.webtestRe: [Webtest] Clicking a button not w...
FromSent OnAttachments
Noam Aigerman06 Jun 2008 07:15 
Trent Ohannessian06 Jun 2008 08:13 
Noam Aigerman06 Jun 2008 08:24 
Marc Guillemot09 Jun 2008 02:02 
Subject:Re: [Webtest] Clicking a button not working in form
From:Marc Guillemot (mgui@yahoo.fr)
Date:06/09/2008 02:02:56 AM
List:com.canoo.lists.webtest

Hi,

your html is not well formed which leads to "lost form children".

HtmlUnit 2.2 will be able to handle this kind of invalid html. You can already pick a snapshot from http://build.canoo.com/htmlunit/artifacts/ and use it in place of HtmlUnit-2.1 in you webtest/lib dir.

Cheers, Marc.

Noam Aigerman wrote:

Hi, I am trying to click the button in the following form:

<form id="addrelatedlink" name="addrelatedlink" action="/Q/What about
0aX6Xruq87pVrEtsu8qQ&action=editrelatedlink" method="POST"
enctype="application/x-www-form-urlencoded">

Title:

</td><td colspan="2" style="padding-left: 5px;">

<input id="new_title" type=text name="new_title" value="" maxlength=100 size=80
onkeydown="javascript:urlTitleTooLong()"
onkeypress="javascript:urlTitleTooLong()" />

</td>

</tr>

<tr style="color:#666666;">

<td></td>

<td style="font-style:italic;padding-left: 5px; width: 78px; vertical-align:
top; padding-top: 5px;">Examples:</td>

<td><ul style="list-style-type:none;list-style-position:outside;margin-left:0;">
<li>WebMD</li><li> BBC: Somali troops close in on capital</li><li> Answers.com:
North Korea</li></ul>

</td></tr>

<tr><td><br/></td></tr>

<tr>

<td ALIGN=RIGHT>URL/Address:</td>

<td colspan="2" style="padding-left: 5px;"><input type=text name="new_url"
value="" size=80></td></tr>

<tr style="color:#666666;">

<td></td>

<td style="font-style:italic;padding-left: 5px; width: 78px; vertical-align:
top; padding-top: 5px;">Examples:</td>

<td>

<ul
style="list-style-type:none;list-style-position:outside;margin-left:0;"><li>http://www.WebMD.com/</li>

<li>http://news.bbc.co.uk/2/hi/africa/6214379.stm</li>

<li>http://www.answers.com/topic/north-korea</li><ul></TD></tr>

<tr><td><br/></td></tr>

<tr><td colspan="3"align="center">

<input type="hidden" name="wpSave" value="1"/>

<input type="image" style="margin-top: 15px; cursor: pointer;"
src="http://wa-trunk/templates/icons/bn_add_link.gif?v=28252" title="Add Link"
name="wpSaveButton" value="Add Link"/>

</form>

I tried doing

clickButton xpath='//input[@name="wpSaveButton"]'/>

or

clickButton xpath='//input[@name="wpSave"]'/>

or

<clickElement htmlid="addrelatedlink"/>

All of them don’t fail. But also, non of them leads to a new page (there isn’t a “resulting page” in the results), and the data isn’t posted, so I guess although it can find the button, and it presumes it clicked it, it doesn’t call the JS… any idea?

Thanks, Noam