Bugs item #981906, was opened at 2004-06-29 14:13
Message generated for change (Settings changed) made by matani
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=497982&aid=981906&group_id=61302

Category: None
Group: None
Status: Open
Resolution: None
>Priority: 8
Submitted By: Saleh matani (matani)
Assigned to: Nobody/Anonymous (nobody)
Summary: clickbutton bug

Initial Comment:
the new Version of httpUnit include a bugfix witch use to 
be also fixed bei jWebUnit , i am talking here about 
clickbutton or assertbuttonpresent , this methods are 
implemented to search a button in a form tag , (form) , 
after the HTML 4.0 there is a new tag names <BUTTON> 
and it dose not need forms but with jwebunit and the 
current Release of http Unit there is no way to test 
buttons that are not in <form> tag , the bugfix ist 
allready checked in in the cvs Repository from httpUnit , 
thats mean , if you check out the httpunit and generate 
your jar file then you can work with buttons outer a form 
tag , but you need to make some changes in the 
jwebunit httpUnitDialog.java!
the changes are:


  //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  // bugfix by Saleh Matani
  //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 

  /**
   * @return the forms count in response
   */
  public int getFormCount()
  {
    try
    {
      int i = resp.getForms().length;
      return i;
    }
    catch (SAXException e)
    {
      e.printStackTrace();
    }
    return 0;
  }

  /**
   * Return the HttpUnit Button with a given id.
   *
   * @param buttonId
   */
  public Button getHtmlElementButton(String buttonId)
  {
    try
    {
      Button button = (Button) resp.getElementWithID
(buttonId);
      return button;
    }
    catch (SAXException e)
    {
      return null;
    }
  }

  public Button getFormButton(String buttonId)
  {
    int formCount = getFormCount();
    for (int i = 0; i < formCount; i++)
      if (getForm(i).getButtonWithID(buttonId) != null)
        return getForm(i).getButtonWithID(buttonId);
    return null;
  }

  public Button getButton(String buttonId)
  {
    Button button;
    button = getHtmlElementButton(buttonId);
    if (button != null)
      return button;
    button = getFormButton(buttonId);
    if (button != null)
      return button;
    return null;
  }

  // end bugfix by Saleh Matani !!!!!!!!!!!!!!!!!!!!!!!!!!!! 
  //for Developer! , Please check this code to cvs


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

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


-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 - 
digital self defense, top technical experts, no vendor pitches, 
unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
Jwebunit-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jwebunit-development

Reply via email to