Hi Jevon,

Yes, you are right, the stack trace that I showed is for assertText failure.
I showed that just to show you how the buttons look at the bottom. You can
see the 2 problem buttons with ??? marks.

Also, assertSubmitButtonPresent("buttonValue","???button.select???"); works
fine. So, the select buttons value actually is "???button.select???" and not
"Select" as seen in view source.

I tried the XPath again with the expression that you have given, I still get
an error. The stack trace this time is as below:

Thank you,
Lakshmi.

com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException: 500 Internal
Server Error for
http://outlet.cert.sc.egov.usda.gov/NRRS/processProgramCodeResults.do
 at
com.gargoylesoftware.htmlunit.WebClient.throwFailingHttpStatusCodeExceptionIfNecessary(WebClient.java:530)
 at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:330)
 at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:354)
 at com.gargoylesoftware.htmlunit.html.HtmlForm.submit(HtmlForm.java:179)
 at
com.gargoylesoftware.htmlunit.html.HtmlSubmitInput.doClickAction(HtmlSubmitInput.java:82)
 at
com.gargoylesoftware.htmlunit.html.HtmlElement.click(HtmlElement.java:1329)
 at
com.gargoylesoftware.htmlunit.html.HtmlElement.click(HtmlElement.java:1288)
 at
com.gargoylesoftware.htmlunit.html.HtmlElement.click(HtmlElement.java:1257)
 at
net.sourceforge.jwebunit.htmlunit.HtmlUnitTestingEngineImpl.clickElementByXPath(HtmlUnitTestingEngineImpl.java:1864)
 at
net.sourceforge.jwebunit.junit.WebTester.clickElementByXPath(WebTester.java:2574)
 at
net.sourceforge.jwebunit.junit.WebTestCase.clickElementByXPath(WebTestCase.java:2067)
 at
gov.usda.fsa.tco.test.NRRSExample.testNRRS_EstablishReceivable(NRRSExample.java:224)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:585)
 at junit.framework.TestCase.runTest(TestCase.java:164)
 at junit.framework.TestCase.runBare(TestCase.java:130)
 at net.sourceforge.jwebunit.junit.WebTestCase.runBare(WebTestCase.java:79)
 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:120)
 at junit.framework.TestSuite.runTest(TestSuite.java:230)
 at junit.framework.TestSuite.run(TestSuite.java:225)
 at
org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
 at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(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)


On Wed, Feb 17, 2010 at 5:41 PM, Jevon Wright <je...@jevon.org> wrote:

> Hi Lakshmi,
>
> It looks like there is a problem with your XPath expression: change 
> '@type='submit',
> @name='buttonValue' and @value='???button.select???'' to '@type='submit'*and
> *...@name='buttonValue' and @value='???button.select???''.
>
> The stack trace you are providing does not relate to clicking a button, but
> rather the text content not being visible on the page. If the element could
> not be clicked, a different exception would have been thrown. I also don't
> understand the '@value='???...???'' XPath, because that content isn't on the
> page source attached.
>
> Jevon
>
>
> On Thu, Feb 18, 2010 at 3:51 AM, lakshmi somavaram 
> <lsomava...@gmail.com>wrote:
>
>> Hi Jevon,
>>
>> *Here is the code for the buttons from view source of web page:*
>>
>> <input type="submit" name="buttonValue" value="Select"
>> class="actionbutton">
>>     <input type="reset" value="Reset" class="actionbutton">
>>
>>    <input type="submit" name="buttonValue" value="Back"
>> class="actionbutton">
>>    <input type="submit" name="org.apache.struts.taglib.html.CANCEL"
>> value="Cancel" onclick="bCancel=true;" class="actionbutton">
>>
>> *Here is the code for the clickElementByXPath:*
>>
>> clickElementByXPath("//inp...@type='submit' and @value='Select']");
>>
>> clickElementByXPath("//inp...@type='submit', @name='buttonValue' and
>> @value='???button.select???']");
>>
>> *When assert text was used with the wrong text, the page source looked
>> like below:*
>> We can notice below that the buttons with problem are resolved with
>> question marks like ???button.select??? Reset ???button.back??? Cancel
>>
>> -----------------------------------------------------------------------------------------------------------------------------
>>  junit.framework.AssertionFailedError: Expected text not found in current
>> page: [Create New Receivable]
>>  Page content was: [National Receipts & Receivables System
>>
>>
>> Farm Service Agency
>>  National Receipts & Receivables System
>> Home About USDA Help Contact Us Log Off
>>
>> Program Code Search Results
>> ???label.accounting.program.codes???
>>   ???label.general.name? <http://label.general.name/?>
>> ?? ???label.general.description???
>> checked 01ADDLNINTAPNT ADD'L LOAN INTEREST - PEANUTS, ADD'L
>> unchecked 01APNTSLNT LOAN TRANSFER - PEANUTS, ADD'L
>> ???button.select??? Reset ???button.back??? Cancel
>> NRRS-Web-2.21
>>
>> | Home | USDA Internet | USDA Intranet | FSA Internet | FSA Intranet
>> | FOIA | Accessibility Statement | Privacy Policy | Non-Discrimination
>> Statement | Information Quality | FirstGov | White House |]
>>  at junit.framework.Assert.fail(Assert.java:47)
>>  at
>> net.sourceforge.jwebunit.junit.WebTester.assertTextPresent(WebTester.java:442)
>>  at
>> net.sourceforge.jwebunit.junit.WebTestCase.assertTextPresent(WebTestCase.java:372)
>>  at
>> gov.usda.fsa.tco.test.NRRSExample.testNRRS_EstablishReceivable(NRRSExample.java:231)
>>  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>  at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>  at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>  at java.lang.reflect.Method.invoke(Method.java:585)
>>  at junit.framework.TestCase.runTest(TestCase.java:164)
>>  at junit.framework.TestCase.runBare(TestCase.java:130)
>>  at
>> net.sourceforge.jwebunit.junit.WebTestCase.runBare(WebTestCase.java:79)
>>  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:120)
>>  at junit.framework.TestSuite.runTest(TestSuite.java:230)
>>  at junit.framework.TestSuite.run(TestSuite.java:225)
>>  at
>> org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
>>  at
>> org.eclipse.jdt.internal.junit.runner.TestExecution.run(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)
>>
>>
>>
>>  
>> -----------------------------------------------------------------------------------------------------------------------------
>> Thank you,
>> Lakshmi
>>
>>
>>
>>
>> On Tue, Feb 16, 2010 at 3:48 PM, Jevon Wright <je...@jevon.org> wrote:
>>
>>> Hi Lakshmi,
>>>
>>> Can you post the HTML source code of the generated buttons, and the code
>>> you were trying to use with clickElementByXPath()?
>>>
>>> The two libraries you have mentioned are server-side libraries. JWebUnit
>>> actually navigates the web application from the point of view of a browser,
>>> using HtmlUnit. It has no idea which server-side technology you are using -
>>> so for example, you could test JSP, PHP, .Net or even CGI applications with
>>> it.
>>>
>>> Jevon
>>>
>>>   On Wed, Feb 17, 2010 at 5:13 AM, lakshmi somavaram <
>>> lsomava...@gmail.com> wrote:
>>>
>>>>   Dear users,
>>>>
>>>> I have 4 buttons on a webpage and JwebUnit (clickButtonWithText)
>>>> recognizes 2 of them and not the other 2.
>>>> After speaking with developers, I heard that 2 that are recognized were
>>>> created using struts.apache.org/tags-html tag library
>>>> The 2 that do not work were created with java.sun.com/jsp/jstl/fmtlibrary
>>>>
>>>> I have tried using all the submit() functions as well. I also used,
>>>> clickElementByXPath.
>>>>
>>>> Any idea how this can be resolved? Also, what is used for rendering the
>>>> pages in JWebUnit? Does theJWebUnit  program that renders the webpage use
>>>> both the libraries that I have mentioned?
>>>>
>>>> Any help will be greatly appreciated.
>>>>
>>>> Thank you,
>>>> Lakshmi.
>>>>
>>>>
>>>>
>>>>
>>>> ------------------------------------------------------------------------------
>>>> SOLARIS 10 is the OS for Data Centers - provides features such as
>>>> DTrace,
>>>> Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
>>>> http://p.sf.net/sfu/solaris-dev2dev
>>>> _______________________________________________
>>>> JWebUnit-users mailing list
>>>> JWebUnit-users@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/jwebunit-users
>>>>
>>>>
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
>>> Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
>>> http://p.sf.net/sfu/solaris-dev2dev
>>> _______________________________________________
>>> JWebUnit-users mailing list
>>> JWebUnit-users@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/jwebunit-users
>>>
>>>
>>
>>
>> ------------------------------------------------------------------------------
>> SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
>> Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
>> http://p.sf.net/sfu/solaris-dev2dev
>> _______________________________________________
>> JWebUnit-users mailing list
>> JWebUnit-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/jwebunit-users
>>
>>
>
>
> ------------------------------------------------------------------------------
> Download Intel&reg; Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> JWebUnit-users mailing list
> JWebUnit-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jwebunit-users
>
>
------------------------------------------------------------------------------
Download Intel&reg; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs 
proactively, and fine-tune applications for parallel performance. 
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
JWebUnit-users mailing list
JWebUnit-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jwebunit-users

Reply via email to