Hi,
I agree that we should provide an interface to get the testing engine,
though it shouldn't really be used.
Perhaps adding a method getPageDom(), which returns the XML DOM of the
current page (if applicable)? At least in this way, it is testing engine
independent. I'll add this to the SF tracker soon.
If all the checkboxes are in form:
<tr>
<td id="...">
<input type="checkbox" />
You could perhaps do something currently like so:
List<IElement> checkboxes =
getElementsByXpath("//t...@id]/input[type='checkbox']");
for (IElement e : checkboxes) {
assertTrue( e.getAttribute("checked") );
}
Not sure if this works but it's a start.
Cheers
Jevon
On Wed, Apr 15, 2009 at 1:23 AM, Kai Wiemer <k_ae...@web.de> wrote:
> Hi Steve,
> Hi Julien,
>
> I also want to add a comment concerning underlying HtmlUnit.
>
> First of all: I understand why JWebUnit wants to be as independent as
> possible of HtmlUnit. But not for the first time, I need to get access
> to more specific functions of HtmlUnit. Here's a short summary:
>
> The web application we develop and test supports searching for, lets
> say users. The data will be retrieved from a database and is displayed
> in a html table in which each <tr> has a unique id (<tr
> id="bla_1"...>). Each data record has a boolean attribute, which is
> displayed in a checkbox in the same row. Nothing complicated so far.
>
> The results of that query may vary, because the stored data changes.
> So the tester, as well as the automated tests, do not know about the
> exact result list. Now I want to assert that all checkboxes are
> checked or unchecked.
>
> I did not find any functionality in JWebUnit that would do that for me
> (which does not imply that this functionality does not exist :-) ). I
> simply do not know the value of the name- or id-attributes. So, the
> most comfortable way would be to get access to HtmlUnit's
> com.gargoylesoftware.htmlunit.Page object. For example by calling the
> (so far private) method
>
> HtmlPage page = ((HtmlUnitTestingEngineImpl)
> tester.getTestingEngine()).getCurrentPage();
>
> (Or adding a method 'HtmlPage getCurrentPage()' to the implemented
> interface)
>
> This has even more advantages, as access to the dom tree means more
> freedom in iterating and inspecting the current page.
>
> Is there a more elegant/easier way to do that? If not, maybe my
> explanation could be considered in a future release of JWebUnit.
>
> Any comments are welcome.
>
> Greetings from germany
>
> Kai
>
> On Thu, Feb 12, 2009 at 10:24, Julien HENRY <henr...@yahoo.fr> wrote:
> > Hi Steve,
> >
> > In the past, JWebUnit tried to be independent of underlying
> implementation (HttpUnit, HtmlUnit, Selenium, ...). That's why there is no
> HtmlUnit specific code in the API. I recognize it may be problematic for
> specific needs. There is a way to get the underlying plugin (methods called
> getTestingEngine() or something like that) but because it was not designed
> to be used this way, I'm not sure you can access all methods you need to
> change refresh handler (I'm not sure there are public getter/setter).
> > Whatever is your need, feel free to propose evolution of the code, and
> submitting a patch is the way to improve the tool. I'm sure you are not the
> only one that miss this functionality.
> >
> > Best regards,
> >
> > Julien
> >
> >
> >
> >
> > ----- Message d'origine ----
> > De : "Moyer, Steve" <steve.mo...@arrisi.com>
> > À : "jwebunit-users@lists.sourceforge.net" <
> jwebunit-users@lists.sourceforge.net>
> > Envoyé le : Mercredi, 11 Février 2009, 21h51mn 13s
> > Objet : [JWebUnit-users] HtmlUnit configuration ...
> >
> > Is there some established way to control the underlying HtmlUnit engine
> from JWebUnit? In JWebUnit 2.1, I am trying to test a web page that
> includes a meta-refresh tag that references itself (It's a network
> monitoring application and we use it to provide status updates). With the
> recent reversion of HtmlUnit's ImmediateRefreshHandler to an older version
> of the codebase, it fails regardless of how I setup the test.
> >
> > The bigger issue is that using the ImmediateRefreshHandler is not at all
> correct for all tests. I'm interested in navigating to this page, clicking
> on a link and continuing my test path. The ImmediateRefreshHandler reloads
> the page as soon as I get to it, so clicking on the desired link is only
> intermittently possible.
> >
> > I have the feeling that I'm missing something (probably conceptual)
> regarding how the JWebUnit framework is to be used ... isn't there some way
> to access the underlying HtmlUnit engine and set these parameters so that my
> test runs in a realistic fashion?
> >
> > Hopefully I just clueless!
> >
> > Thanks, smoyer
> >
> ------------------------------------------------------------------------------
> > Create and Deploy Rich Internet Apps outside the browser with
> Adobe(R)AIR(TM)
> > software. With Adobe AIR, Ajax developers can use existing skills and
> code to
> > build responsive, highly engaging applications that combine the power of
> local
> > resources and data with the reach of the web. Download the Adobe AIR SDK
> and
> > Ajax docs to start building applications today-
> http://p.sf.net/sfu/adobe-com
> > _______________________________________________
> > JWebUnit-users mailing list
> > JWebUnit-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/jwebunit-users
> >
> >
> >
> >
>
> __________________________________________________________________________________________________
> > Ne pleurez pas si votre Webmail ferme ! Récupérez votre historique sur
> Yahoo! Mail ! http://fr.docs.yahoo.com/mail/transfert_mails.html
> >
> >
> >
> ------------------------------------------------------------------------------
> > Create and Deploy Rich Internet Apps outside the browser with
> Adobe(R)AIR(TM)
> > software. With Adobe AIR, Ajax developers can use existing skills and
> code to
> > build responsive, highly engaging applications that combine the power of
> local
> > resources and data with the reach of the web. Download the Adobe AIR SDK
> and
> > Ajax docs to start building applications today-
> http://p.sf.net/sfu/adobe-com
> > _______________________________________________
> > JWebUnit-users mailing list
> > JWebUnit-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/jwebunit-users
> >
>
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by:
> High Quality Requirements in a Collaborative Environment.
> Download a free trial of Rational Requirements Composer Now!
> http://p.sf.net/sfu/www-ibm-com
> _______________________________________________
> JWebUnit-users mailing list
> JWebUnit-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jwebunit-users
>
>
------------------------------------------------------------------------------
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
_______________________________________________
JWebUnit-users mailing list
JWebUnit-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jwebunit-users