Bugs item #1567947, was opened at 2006-09-29 20:50
Message generated for change (Settings changed) made by henryju
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=497982&aid=1567947&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: HtmlUnit plugin
>Group: Release 1.4
>Status: Closed
>Resolution: Fixed
Priority: 8
Submitted By: Jack (jackandjack)
Assigned to: Julien HENRY (henryju)
Summary: getButtonWithText() is not returning the HtmlButton

Initial Comment:
I downloaded the latest version of JWebUnit from this 
site and started with a simple testCase.

I have a page with "Previous" button and when I tried
***************************************
assertButtonPresentWithText("Previous");
***************************************
I am getting the unittest case failure...and here is 
the trace.

junit.framework.AssertionFailedError: Did not find 
button with text [Previous].
        at junit.framework.Assert.fail(Assert.java:47)
        at junit.framework.Assert.assertTrue
(Assert.java:20)
        at 
net.sourceforge.jwebunit.WebTester.assertButtonPresent
WithText(WebTester.java:1231)
        at 
net.sourceforge.jwebunit.WebTestCase.assertButtonPrese
ntWithText(WebTestCase.java:450)
        at 
core.NonIndividualProfileWebTest.testCardOptions
(NonIndividualProfileWebTest.java:42)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke0(Native 
Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke
(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke
(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown 
Source)
        at junit.framework.TestCase.runTest
(TestCase.java:154)
        at junit.framework.TestCase.runBare
(TestCase.java:127)
        at 
net.sourceforge.jwebunit.WebTestCase.runBare
(WebTestCase.java:50)
        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 
org.eclipse.jdt.internal.junit.runner.junit3.JUnit3Tes
tReference.run(JUnit3TestReference.java:128)
        at 
org.eclipse.jdt.internal.junit.runner.TestExecution.ru
n(TestExecution.java:38)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner
.runTests(RemoteTestRunner.java:460)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner
.runTests(RemoteTestRunner.java:673)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner
.run(RemoteTestRunner.java:386)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner
.main(RemoteTestRunner.java:196)


When I traced the code in HtmlUnitDialog.java
the following method is looking for "button" Html 
Elements by Tag...
**********************************
 public HtmlButton getButtonWithText(String 
buttonValueText) {
        List l = ((HtmlPage) win.getEnclosedPage
()).getDocumentElement()
                .getHtmlElementsByTagNames(
                        Arrays.asList(new String[] 
{ "button" }));
        for (int i = 0; i < l.size(); i++) {
            HtmlElement e = (HtmlElement) l.get(i);
            if (((HtmlButton) e).getValueAttribute
().equals(buttonValueText))
                return (HtmlButton) e;
        }
        return null;
    }
******************************************
When I did the debug again with 
getHtmlElementsByTagName( final String tagName ) 
method, the HtmlElement.getTagName() returns always 
html elements like table,tr,input.. and so not 
matching with "button" resulting in a no button found 
error...








----------------------------------------------------------------------

Comment By: Julien HENRY (henryju)
Date: 2006-10-02 09:24

Message:
Logged In: YES 
user_id=1235926

OK, fixed. AssertButtonPresentWithText was checking button
value attribut instead of text between <button> </button> tags.

It will be in next bugfix release.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=497982&aid=1567947&group_id=61302

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Jwebunit-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jwebunit-development

Reply via email to