Bugs item #1845893, was opened at 2007-12-07 01:37
Message generated for change (Comment added) made by henryju
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=497982&aid=1845893&group_id=61302
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
>Category: Core API
>Group: Release 1.5
>Status: Closed
>Resolution: Fixed
Priority: 5
Private: No
Submitted By: Mike (mtc3b)
>Assigned to: Julien HENRY (henryju)
Summary: No way to click input of type button
Initial Comment:
If you have HTML with an <input type="button" value="value"> you'd think that
WebTester.clickButtonWithText("value") would allow you to click it.
Unfortunately, clickButtonWithText utilizing HtmlUnitDialog.getButtonWithText()
which returns only an HtmlButton (i.e. a <button> element). Beyond potentially
using clickElementByXPath(), you can't actually click this type of button.
Note that getButton() will work if the input has an id. (that is <input
type="button" value="value" id="mybutton"> can be clicked via
getButton("value")).
HtmlUnitDialog.getButton() returns a ClickableElement, which is what
HtmlUnitDialog.getButtonWithText() should do.
----------------------------------------------------------------------
>Comment By: Julien HENRY (henryju)
Date: 2007-12-08 21:32
Message:
Logged In: YES
user_id=1235926
Originator: NO
Thanks for your contribution. I added a check to prevent NPE and some test
cases.
Applied in trunk.
----------------------------------------------------------------------
Comment By: Mike (mtc3b)
Date: 2007-12-07 23:17
Message:
Logged In: YES
user_id=1954039
Originator: YES
I downloaded the trunk and made some changes to HtmlUnitTestingEngineImpl.
Attaching the patch file. I made getButtonWithText() consistent with
getButton() in searching for HtmlButton as well as HtmlButtonInput,
HtmlSubmitInput, and HtmlResetInput. All of these are "buttons" as far as
the browser is concerned. I also updated some JavaDoc and made some
essentially cosmetic changes to hasButtonWithText() and
clickButtonWithText(). The latter was calling getButtonWithText() twice
for no apparent gain.
My patch solves my problem and passes all tests. Note that it is not
binary compatible as the return value of getButtonWithText(), which is
public, changes from HtmlButton to ClickableElement. But, no end users
should be calling that method directly.
File Added: HtmlButtonInput.patch
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=497982&aid=1845893&group_id=61302
-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
JWebUnit-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jwebunit-development