20

Can I fill out forms, execute events and Javascript functions in Jsoup? If yes how can I? Or should I go for another parser.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129

2 Answers2

37

JSoup is just an HTML parser/"tidyfier" - not a browser emulator. To interact with HTML pages (execute javascript, fill out forms, etc.) you should use a tool like HtmlUnit or Selenium.

dm3
  • 2,038
  • 2
  • 17
  • 20
  • OK Ok. I have a problem, I have two dropdowns on HTML page. When one drop down is changed, the options in other dropdown change. I want to change the first dropdown value in Java code, and then get the new values in the second dropdown, how can I do it in HTML unit? –  Sep 08 '11 at 07:28
3

Use Selenium - if you use Selenium 2 WebDriver API, the main classes there are WebDriver, FirefoxDriver, and JavascriptExecutor.

Rostislav Matl
  • 4,294
  • 4
  • 29
  • 53