Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HttpUnit , Javascript Errors

 
Venkata Kiran
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hai All,
I am testing a website using HttpUnit.
The website uses Javascript Redirects instead of plain Html Links.
How can I test these Links using HttpUnit.
Thanking You .
[ October 19, 2005: Message edited by: Kiran sss ]
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What happens when you test them with HttpUnit? Does it not work? If not, in what way, any error messages?

By the way, your display name does not conform to the JavaRanch policy. You should correct it.
 
Venkata Kiran
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The link click is not working for the Javascript Redirects.
No error messages ,but I am not even able to go to the next page.
The same code is working with normal Hyperlinks.
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could you post the JavaScript snippet(s) that are not working?
I assume you've already tried to compare what functions you use to the list of supported functions?
 
Venkata Kiran
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The page contains 3 frames in which the Hyperlinks are present.

The Html code of the two links which call the JavaScript function are:

<td ID="menu_cell_search" class="MenuTD" align="center"><a ID="menu_link_1" onclicq="menuGoUrl('select_search_fr', parent.index_main);return false" href="#" target="index_main">Search</a></td>

<td ID="menu_cell_reports" class="MenuTD" align="center"><a ID="menu_link_2" onclicq="menuGoUrl('reports_menu', parent.index_main)" href="#">Reports</a></td>

Both these links point to two different links and pages but show the same URL.


The JavaScript function which is being called:


[ October 24, 2005: Message edited by: Lasse Koskela ]
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, nothing jumps out at least to my eyes. I'd suggest the brunt force approach -- commenting out "extra" bits of the JavaScript to find out the minimal working set and then start uncommenting things until you find the part that HttpUnit's Rhino JavaScript engine can't deal with. (And then try to come up with another bit of JavaScript that it can deal with)

By the way, are you using IE specific stuff in there?
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh, and Ulf is correct -- your display name does not conform to the policy, which only allows initials for the first name, not the family name. We'd appreciate it if you could take a minute to edit your profile. Thanks.
 
Venkata Kiran
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are there any links to verify how HttpUnit works with Javascript Redirect
& frames.
 
Venkata Kiran
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
is the problem bcos of the links being within <td> tags.
Is link click from <tr> supported in Httpunit now.
I saw this link & understood that the click was not working previously.
http://sourceforge.net/tracker/?group_id=6550&atid=356550
Request Id :1090785
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Kiran Kumar:
is the problem bcos of the links being within <td> tags.
Is link click from <tr> supported in Httpunit now.
I saw this link & understood that the click was not working previously.
http://sourceforge.net/tracker/?group_id=6550&atid=356550
Request Id :1090785

What that request is about is not your situation. The request talks about having something like this:

while you have something like this:
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Kiran Kumar:
Are there any links to verify how HttpUnit works with Javascript Redirect
& frames.

I'm not aware of any (but I also haven't looked).

What I'd suggest is try things out in a small, simple, isolated sandbox until you get an idea of what works and what doesn't.

For example, you could quickly sketch up a simple set of framed HTML pages with the simplest table you can think of, having the links and pieces of JavaScript you have in the actual application. You could dump these files on Apache and start hacking with a very fast cycle of 1) edit html/javascript, 2) verify visually in a browser, 3) run a simple HttpUnit test to see if HttpUnit can deal with what you have.



I'm not sure if you've already tried what I suggested earlier, about commenting out stuff that's sort of "extra". I'd probably start by commenting out these two pieces:

(simply because I can't see their sources and so I'm tempted to believe they might be doing something non-compatible)
 
Venkata Kiran
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The JS code is from a client's site which I am testing so I can't minimise or remove any part of the Javascript code.
But I found out this link which describes similar problem but used images
instead of normal text for hyperlinks :

https://sourceforge.net/forum/forum.php?thread_id=1317264&forum_id=20295

Trying out on that basis.
Thank u for the help.
[ October 26, 2005: Message edited by: Kiran Kumar ]
 
Venkata Kiran
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hai ,
r there any examples for using WebWindow or WebClient in HttpUnit.
Thank u in advance.
 
Mat DeLong
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Has a solution to this been found? I was using one version of httpUnit (unknown) and switched to another, and then my links which called javaScript functions stopped working.
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Generally speaking, if HttpUnit/jWebUnit/HtmlUnit/whatever tool you're using suddenly stops supporting the kind of JavaScript you have in your application, I'd recommend taking it up on the respective tool's mailing list. If the JavaScript you've used is cross-browser compatible (or standard) then it's likely a bug. If not, then you should probably change your application anyway.
 
Venkata Kiran
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry I was not able to get any break through and had to leave that in middle.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic