Feature Requests item #1653557, was opened at 2007-02-07 08:46
Message generated for change (Comment added) made by jevonwright
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=497985&aid=1653557&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: None
Group: Release 2.1
Status: Closed
Priority: 5
Private: No
Submitted By: Aaron Loes (loesak)
Assigned to: Jevon Wright (jevonwright)
Summary: Access to ALL elements by Id
Initial Comment:
I apologize if this is cryptic, this is my first feature submission.
I am currently working QA for a client with very detailed design requirements.
Every element on a web page definition has a unique id associated to it. For
testing, we use this unique id as the id attribute for the html elements.
We are looking at using jWebUnit to perform our validation, but we cannot
verify every type of html element by id. Therefore, we extend WebTestCase and
write our own assertions to verify by id. In these cases, we just assert the
element exists and then assert the other condition (i.e.
assertLinkWithExactText, etc). This, although a adequate option, can prove to
yield false positives (The element with the id exists and the link with exact
text exists but are not the same element).
Another need is to verify an element with the given id contains another
element. Many of our id's had to be put in parent elements and it would be
desirable to verify that such parent elements contain child elements (i.e.
images inside links, links inside tables, other elements inside spans, etc.).
Not sure of best practice to implement this, but here is what I see as a
preferred option:
* have overloaded functions for each assertXXX where an id is taken as an
argument and the element with the id is verified to be the desired element
(i.e. assertLinkWithExactText(String id, String text) asserts the element with
given id is indeed a link and contains the exact text).
* have functions that verify the element with the given id contains another
element (i.e. assertLinkWithExactTextInElement(String id, String text) verifies
that a link with the exact text is contained in the element found to have the
given id).
I believe the first suggestion is the most important as all elements can
contain id arguments, and it would be most helpful to find, and verify, those
elements by their id.
The second suggestion is helpful as there are situations were you need to
verify that an element has a desired child element. The only implementation
that I have found is just the assertTextInElement, even though text does not
have an element.
(is lack of an element still an element?)
Please feel free to ask if you have questions.
I hope everything in this was clear, concise and spelt correctly.
----------------------------------------------------------------------
Comment By: Jevon Wright (jevonwright)
Date: 2008-11-16 19:51
Message:
Thanks for the reply, yes all of this can now be performed with JWebUnit --
except for getting a child element by ID, as this doesn't make sense (in
HTML, an ID is designed to uniquely identify only one element in a
document), but you can get other child elements (e.g. child <li>'s of a
<ul>).
----------------------------------------------------------------------
Comment By: Aaron Loes (loesak)
Date: 2008-11-15 15:26
Message:
Sorry for not responding sooner but this was posted a while back. Since
then I've taken another job as a software engineer else where. The idea
behind this was to be able to grab any element by a unique identifier and
verify things on it. For example, element type, attribute values, and to
get child elements by similar methods.
element = getElementById("elementId");
assert(element.elementType("a"));
assert(element.attributeEquals("href", "somelink.html");
element_a = element.getElementById("element_aID"); // only gets child
elements of element
assert(element_a.attributeEquals("src", "someimage.jpg"));
or whatever gets the job done.
----------------------------------------------------------------------
Comment By: SourceForge Robot (sf-robot)
Date: 2008-11-12 15:20
Message:
This Tracker item was closed automatically by the system. It was
previously set to a Pending status, and the original submitter
did not respond within 14 days (the time period specified by
the administrator of this Tracker).
----------------------------------------------------------------------
Comment By: Jevon Wright (jevonwright)
Date: 2008-10-29 14:10
Message:
In SVN trunk you can now get elements directly, does this match your
requirements?
IElement element = getElementById("input_id");
assertEquals(element.getAttribute("value", "text field value");
----------------------------------------------------------------------
Comment By: Jevon Wright (jevonwright)
Date: 2008-10-29 01:40
Message:
I plan to implement some of these features in the new IElement interface
for the next release.
----------------------------------------------------------------------
Comment By: Julien HENRY (henryju)
Date: 2007-03-04 11:13
Message:
Logged In: YES
user_id=1235926
Originator: NO
OK, I will try to improve this. But it will be for 1.5...
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=497985&aid=1653557&group_id=61302
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
JWebUnit-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jwebunit-development