SeleniumHQ / SeleniumHQ/htmlunit-driver

Forms are submitted twice if Javascript is enabled

Open
#154 16 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
266
Forks
91
PR merge metrics
No merged PRs in 30d

Description

In com.gargoylesoftware.htmlunit.html.HtmlForm:submit the first HttpPost is done through Javascript call.
Then webClient.download is called and a second HttpPost is done.

This behavior is causing a problem with Okta authentication server which redirect to password page for the first HttpPost but for the second one we get a redirection to the username prompt, causing a loop.

I tried a browser without JS_FORM_SUBMIT_FORCES_DOWNLOAD (Firefox) but because of some tests a second call is still made.

I think you should not do a second call when Javascript is enabled, no matter if JS_FORM_SUBMIT_FORCES_DOWNLOAD is supported or not. Or at least put an option to avoid a second download.

I have a workaround to make it work, I disable Javascript for this page, and reenable it after. Hopefully the login page don't need Javascript enabled, so it works.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in com.gargoylesoftware.htmlunit.html.HtmlForm:submit and trace the Javascript form submission followed by webClient.download. Reproduce with Javascript enabled and inspect the existing tests that cover form submission; done means the request is not submitted twice while the relevant behavior remains covered.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.