Jsoup Java HTML parser : Executing Javascript events

27,304

Solution 1

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.

Solution 2

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

Share:
27,304
Admin
Author by

Admin

Updated on July 05, 2022

Comments

  • Admin
    Admin almost 2 years

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

  • Admin
    Admin over 12 years
    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?