[Webtest] Couple of htmlunit issues.

Koorosh Vakhshoori webtest@lists.canoo.com
Thu, 06 Jan 2005 12:06:48 -0800


Hi all,
   Recently I started migrating my regression tests to HTMLUNIT based 
version of Webtest, version 1.7 build #593. So far I found the following 
two issues:

1) The INPUT tag TYPE attribute is case sensitive in HTMLUNIT. For example, 
I have the following INPUT tag in a page:

<INPUT TYPE="Submit" NAME="Update" VALUE="Update">

When running the Webtest, it could not recognize 'Submit' as a valid button 
type. After some investigation, it turns out that Webtest in 
ClickButton.java in method findButton() is calling HTMLUNIT as follows:

inputButtons.addAll(form.getHtmlElementsByAttribute("input","type","submit"));

When I looked into HTMLUNIT source code for this method:

File: com/gargoylesoftware/htmlunit/html/HtmlElement.java
Method: getHtmlElementsByAttribute()
Line:
if (attValue != null && attValue.equals(attributeValue)) { list.add(next); }

It looks like that the search is case sensitive. As far as I understand 
HTML syntax there is no case sensitively rule for attributes, I maybe 
wrong. I changed the line to following:

if (attValue != null && attValue.equalsIgnoreCase(attributeValue)) { 
list.add(next); }

This solved my problem.

2) I have a few HTML pages that use JS methods window.setTimeout() and 
window.clearTimeout(). On the HTMLUNIT page, it states that 
window.setTimeout() is supported, but there is not mention of 
window.clearTimeout(). Refer to URL:

http://htmlunit.sourceforge.net/javascriptConfiguration.html

A while back, Lisa, refer to following posting:

http://lists.canoo.com/pipermail/webtest/2004q4/002634.html

Mentioned about some JS problems in regards to some calendar pop up. I 
noticed it is using window.setTimeout() and window.clearTimeout(). Her 
problem may also have to do with lack of HTMLUNIT support for clearTimeout. 
I also noticed on HTMLUnit, there was some sort of bug with setTimeout() 
which is fixed in CVS version of the code, I have not had a chance to test 
the latest Webtest and HTMLUNIT. Anyway, I have logged a feature request 
#1090094 with HTMLUNIT group on this topic.

Take care,
Koorosh