Menu

#39 Access to form elements by ID

Release_2.1
closed
Core API (44)
5
2008-11-18
2004-09-06
No

Dear All,
I use a framework that generates all the form included
input types of any kind.... it gives to all form
elements proprietary names that I cannot discover at
runtime.
So is very difficult to use jwebunit to test this kind
of forms.

But I can use the id attribute for every form element,
button, submit... so now I'm asking you if I can access
(set, get the form values) using the ID...

Now I have a code snipped like this:

private String getNameByID(String ID,WebResponse resp)
{
String result=null;
HTMLElement testo;
try {
testo=resp.getElementWithID("firstname");
result=testo.getName();
}
catch (Exception e)
{
System.out.println("exception...to debug...");
}

        return result;

    \}

I pass tho this method the "ID" and the httpunid
webresponse object to get the "name" of a form element...

I don't think this is an "optimal" solution....

Could you extend jwebunit to get this feature available?

Many thanks
Ivan

Discussion

  • Jim Weaver

    Jim Weaver - 2004-09-22

    Logged In: YES
    user_id=619947

    Is this tapestry?

    If so, it seems like I remember someone posting or telling
    me about a way around that problem (fixing form element
    names to specific values).

     
  • Jim Weaver

    Jim Weaver - 2004-09-22
    • status: open --> pending
     
  • Ivan Codarin

    Ivan Codarin - 2004-09-29
    • status: pending --> open
     
  • Ivan Codarin

    Ivan Codarin - 2004-09-29

    Logged In: YES
    user_id=442311

    I use dbforms, yet another mvc framework.
    I have to access to elements by id because this frameworks
    writes form.elements with its own names.

    thanks
    ivan

     
  • Julien HENRY

    Julien HENRY - 2006-06-02
    • assigned_to: nobody --> henryju
    • labels: --> Core API
     
  • Julien HENRY

    Julien HENRY - 2008-10-29
    • assigned_to: henryju --> nobody
     
  • Jevon Wright

    Jevon Wright - 2008-11-18

    This artifact has been marked as a duplicate of artifact 1653557 with reason:
    JWebUnit now has getElementById(id) method.\

     
  • Jevon Wright

    Jevon Wright - 2008-11-18
    • status: open --> closed
     
  • Jevon Wright

    Jevon Wright - 2008-11-18
    • assigned_to: nobody --> jevonwright
    • milestone: --> Release_2.1
     

Log in to post a comment.