Questions tagged [htmlunit]

HtmlUnit is a "headless browser". Which means that there is no browser GUI and it does no rendering. Though it has a CSS and JS engine to simulate a real browser. Primary purpose is testing and information extraction.

HtmlUnit is a "GUI-Less browser for Java programs". It models HTML documents and provides an API that allows you to invoke pages, fill out forms, click links, etc... just like you do in your "normal" browser.

It has fairly good JavaScript support (which is constantly improving) and is able to work even with quite complex AJAX libraries, simulating Chrome, Firefox or Internet Explorer depending on the configuration used.

It is typically used for testing purposes or to retrieve information from web sites.

HtmlUnit is not a generic unit testing framework. It is specifically a way to simulate a browser for testing purposes and is intended to be used within another testing framework such as JUnit or TestNG.

HtmlUnit is used as the underlying "browser" by different Open Source tools like Canoo WebTest, JWebUnit, Selenium WebDriver, JSFUnit, Celerity, ...

HtmlUnit was originally written by Mike Bowler of Gargoyle Software and is released under the Apache 2 license.

Useful links

1835 questions
0
votes
1 answer

how to web login httpunit (with out form)

how to web login using httpunit? I am very very new to HtmlUnit. i want a login but this code i can't find form anywhere.. how can i do login..? plz help...

0
votes
1 answer

How to get the content of a specific iframe using HtmlUnit. Iframe doesn't have name but it has ID

I want to get the content of a specific iframe using HtmlUnit. From one of the post (HtmlUnit can't get the js / ajax added of IFRAME) I got an idea that I can use this code: HtmlPage currentPage = (HtmlPage)webClient.getWebWindowByName("Frame…
Shashank
  • 712
  • 15
  • 33
0
votes
2 answers

How to script behavior like clicking on SVG using python

For example a site I need to script clicking "close" button on an appeared frame. I'm already tried using xpath, css_selection still worthless. Need to do stuff using headless-browser, like HtmlUnit Because there is no "a"-tag. from selenium import…
kAldown
  • 610
  • 2
  • 8
  • 27
0
votes
2 answers

HTMLUnit - Clicking on link does not work

Aim: Access webpage and autoclick on a link using HTMLUnit and Java What I tried: Tried clicking on "About" link on google.com website. Code: import java.io.IOException; import java.net.URISyntaxException; import java.net.URL; import…
Java dev
  • 89
  • 1
  • 1
  • 7
0
votes
1 answer

how to parse HTML in android and execute javascript

I am trying to figure out how to parse HTML where I should execute javascript. I was trying a lot of way to do that, but still have nothing For example: HTMLUnit - seems to me like the best parser to execute javascript, but when I try to add…
Mykola
  • 69
  • 1
  • 6
0
votes
0 answers

Extended Html Unit Driver with screenshot capabilities

I am working on code (java) that will open up a selenium headless browser with HTML Unit webdriver and then take a screenshot. Unfortunately, HTML Unit does not support screenshots on its own, so I had to download an extended version: import…
Z Rev
  • 84
  • 1
  • 13
0
votes
1 answer

HtmlUnit getform() form not found

I am a Newbie with HtmlUnit .. I want to login on https://trash-mail.com/posteingang/ . My Code: public static void main(String[] args) throws FailingHttpStatusCodeException, MalformedURLException, IOException { WebClient webClient = new…
MaddinCoy
  • 3
  • 1
0
votes
0 answers

HtmlUnit - lazy loading of images

I am using HtmlUnit to download URL and the webpage is using lazy loading (I think) to load some of the images. Which settings should I use in HtmlUnit so that I can get those images. For example, this is one of the URLs I am trying to…
user2747986
  • 211
  • 2
  • 5
0
votes
1 answer

Java + HtmlUnit WebClient + SSL page

I have some issue with parsing HTML page using htmlUnit WebDriver. I have not any exception. My code looks like: public static void main(String[] args) throws FailingHttpStatusCodeException, MalformedURLException, IOException { …
user2904774
0
votes
1 answer

HtmlUnit throws ambiguous String error in Processing

I am trying to write code in Processing (basically Java) that will get the information from the table here: http://science.nasa.gov/iSat/iSAT-text-only/ I have not started writing the code specific to the table yet because I can't even get this to…
SaJaK
  • 1
  • 2
0
votes
2 answers

HtmlUnit FailingHttpStatusCodeException: 400 Bad Request

This is for my work project so i can't be as specific as i would like to be. The java app i am designing is supposed to do the following : fills the web-page's form, clicks on the submit opens a new page that displays success/failure in 5 seconds,…
Lazaruss
  • 1,107
  • 1
  • 13
  • 24
0
votes
1 answer

HtmlUnit starts a javascript executor daemon thread despite javascript turned off

I show here a MCVE, which can be used to produce appearance of an additional javascript executor thread. You need a HtmlUnit dependency to run it, the maven coordinates for the latest snapshot are:
Danny Lo
  • 1,553
  • 4
  • 26
  • 48
0
votes
0 answers

HtmlUnit 503 Service Unavailable

I want to grab Google search results with HtmlUnit. My code was working for a while, but now I am getting this exception: com.gargoylesoftware.htmlunit.ScriptException: 503 Service Unavailable for…
Jhonny
  • 587
  • 1
  • 6
  • 17
0
votes
1 answer

How to retrieve javascript variable (an array) and its content using HtmlUnit

I am using HtmlUnit to get a page from server. the page has lots of javascript and i want to get some variable values (array, json etc) from page. Is there a way to get all the global variables? the code i am using to get variable is as…
vermap
  • 211
  • 1
  • 2
  • 10
0
votes
0 answers

Htmlunit, get HtmlTable rows and set them to mysql database

I used htmlunit to get htmltable rows.But I cannot set them to mysql database. My database has columns like the htmltable.How can i save current row to my database?? Can anybody help me? Here is my code: final HtmlTable table =…
Caner
  • 43
  • 1
  • 7