• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Httpunit button.click() not working

 
bala nagaraj
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi below is my code to click a button using httpunit's button.click() to request on click java script and submit the page to get next page. It's not working... Any ideas?
WebResponse aeWR = webConversation.getCurrentPage();
WebForm aeWF = aeWR.getFormWithName("f1");
Button[] aeBTN = aeWF.getButtons();
aeBTN[0].click();
aeWR = webConversation.getCurrentPage(); --> Still old page??
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So there are no stack traces?
Maybe the first button in the array is not the one you think it is?
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The tricky bit here is probably the JavaScript. Although recent versions of HTTPUnit support JavaScript, they need the rhino.jar in the test classpath (did you see a messsage like "rhino.jar not found, JavaScript disabled" when the test started?) and not all JavaScript makes sense (HTTPUnit is not actually a browser!).
Can you show us the web page you are testing, and whetever JavaScript code is supposed to be executed when you click the button?
 
Christian Hargraves
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also if clicking that button opens a new window, then the latest response could be obtained by the getOpenWindows()(?) function.
 
rama vijay
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
clicking a button using httpunit's button.click()is not working... Any ideas?
WebResponse aeWR = webConversation.getCurrentPage();
WebForm aeWF = aeWR.getFormWithName("f1");
Button[] aeBTN = aeWF.getButtons();
aeBTN[0].click();
aeWR = webConversation.getCurrentPage();
[ April 15, 2004: Message edited by: rama vijay ]
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Again, what do you mean by "is not working"?
 
akkina sathish
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I am also facing same problem. After button.click() (which contains javascript to get new page) still i am getting oldPage through this WC.getCurrentPage().

(Is it really possible possible to get new page by button click in HTTPunit tests)

AnyOne can Please help me.
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Apparently the JavaScript URL change stuff your buttons are doing is not supported by HttpUnit/Rhino. I'd take this up on the HttpUnit mailing list where the HttpUnit developers might be able to give more advise.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic