apache HTMLUNIT… PROBLEM in handling javascript


I want to login to a website (<a href="http://www.orkut.com" rel="nofollow noreferrer">http://www.orkut.com</a>) through


But when I click on the "Submit" button, it doesn't take me to the expected page that should come after login. Instead it returns the same login page again. In clear sense, there is some problem in login. When I try the same code with sites that doen't have javascript, it works fine so I think I am not able to handle scripts.

I am trying using the follwoing code:

public static void main(String[] args) { final WebClient webClient = new WebClient(); try { HtmlPage loginPage = webClient.getPage(new URL("https://www.google.com/accounts/ServiceLogin?service=orkut&hl=en-US&rm=false&continue=http%3A%2F%2Fwww.orkut.com%2FRedirLogin%3Fmsg%3D0%26page%3Dhttp%253A%252F%252Fwww.orkut.co.in%252FHome.aspx&cd=IN&passive=true&skipvpage=true&sendvemail=false")); System.out.println(loginPage.getTextContent()); List<HtmlForm> forms = loginPage.getForms(); HtmlForm loginForm = forms.get(0); HtmlInput username = loginForm.getInputByName("Email"); HtmlInput password = loginForm.getInputByName("Passwd"); HtmlInput submit = loginForm.getInputByName("signIn"); username.setNodeValue("username"); password.setNodeValue("password"); HtmlPage homePage = submit.click(); Thread.sleep(10 * 1000); System.out.println(homePage.getTextContent()); }catch(Exception ex) { ex.printStackTrace(); } }

When we do click on the "submit" button, in actual it calls first this function


specified as the attribute of the form below

<form id="gaia_loginform" action="https://www.google.com/accounts/ServiceLoginAuth?service=orkut" method="post" onsubmit="return(gaia_onLoginSubmit());">

Can anyone help me in this.



<a href="http://htmlunit.sourceforge.net/javascript.html" rel="nofollow">According to their site</a> the JavaScript support is provided by <a href="http://www.mozilla.org/rhino" rel="nofollow">Mozilla Rhino</a>, so maybe all you need is to add it to your classpath (and perhaps fiddle with some configurations).

Also, HtmlUnit has <a href="http://htmlunit.sourceforge.net/professionalSupport.html" rel="nofollow">professional support</a>


  • option “setThrowExceptionOnScriptError(false)” NOT WORK in HtmlUnit! Why? (Java)
  • Ionic 3 error install native plugin after Ionic 4 release
  • Waiting for promise in for loop
  • Spring Security with REST architecture
  • How can I add an empty option in a select tag created dynamically?
  • IBM Worklight - How to programmatically hide the splash image
  • Detecting typos in JavaScript code
  • How to parse a hidden Javascript section from a HTML page
  • Meteor: Block access to application if user's email is not verified
  • LINQ to Entities does not recognize the method 'System.String ToString()' method, and this
  • C: Incompatible pointer type initializing
  • jQuery ready not fired after rails link_to is clicked
  • Sencha Touch 2.0 Controller refs attribute not working?
  • Android full screen on only one activity?
  • Yii2: Config params vs. const/define
  • $wpdb not working in file of WordPress plugin
  • why overloaded new operator is calling constructor even I am using malloc inside overloading functio
  • how to adjust image in a panel in Java swing?
  • Why value captured by reference in lambda is broken? [duplicate]
  • Spring Data JPA custom method causing PropertyReferenceException
  • Is there any way to access browser form field suggestions from JavaScript?
  • RectangularRangeIndicator format like triangular using dojo
  • Possible to stop flickering java tooltip in heavyweight mode?
  • output of program is not same as passed argument
  • Cross-Platform Protobuf Serialization
  • Google cloud sdk not working when python points python3
  • Akka Routing: Reply's send to router ends up as dead letters
  • Circular dependency while pushing http interceptor
  • Windows forms listbox.selecteditem displaying “System.Data.DataRowView” instead of actual value
  • Revoking OAuth Access Token Results in 404 Not Found
  • AngularJs get employee from factory
  • using HTMLImports.whenReady not working in chrome
  • How to set the response of a form post action to a iframe source?
  • Change div Background jquery
  • apache spark aggregate function using min value
  • unknown Exception android
  • XCode 8, some methods disappeared ? ex: layoutAttributesClass() -> AnyClass
  • Checking variable from a different class in C#
  • Sorting a 2D array using the second column C++
  • Android Heatmap on canvas or ImageView