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

HTMLUnit login to school email using java eclipse with https://

I am working on creating an application where I can pull the information from my schools website, like my class schedule and assignments, so that I don't have to login every time I want to get this info. Simple. Here is my main class that I am using…
ZWis212
  • 132
  • 1
  • 13
0
votes
1 answer

How to locate and write to textfield and click submit with HtmlUnit?

I am completely new to HtmlUnit and I do not really know how to read and understand the page source of a website. Nonetheless, I have written code (learned from this tutorial) to try and access the following website Then I am stuck, as I am not…
mynameisJEFF
  • 4,073
  • 9
  • 50
  • 96
0
votes
1 answer

Using HtmlUnit to get the access token from instagram

Since httpURLconnection didn't cut out, i switched to htmlUnit to get programatically the auth code to get the access token from instagram and then do whatever i need from there, the thing is i'm stuck trying to retrieve the authorization code from…
Progs
  • 1,059
  • 7
  • 27
  • 63
0
votes
1 answer

Clicking on a button with HTMLUnit return just partial code

I'm trying to surf inside an asp.net site with Java using HTMLUnit. When I request the final println at the bottom of the java code the console return just partial code instead of entire webpage's html... I've already tried to add waits for the…
0
votes
0 answers

Unable to execute JavaScript with HtmlUnitDriver

The following code declares a HtmlUnitDriver with javascript enabled using new HtmlUnitDriver(true) and then creates a JavaScriptExecutor like below WebDriver driver = new HtmlUnitDriver(true); JavascriptExecutor js = (JavascriptExecutor)…
0
votes
1 answer

How to extract data from ajax/javascript websites using htmlunit? I m trying to extract shipment history

I m trying to extract shipment history from this page http://www.aramex.com/express/track-results.aspx?q=aWQ9MzU2NDQ4MTQ3Jg%3d%3d-ULINyZQtKrw%3d. This my code: public void aramexTracking() { WebClient webClient = new…
Stacy
  • 1
0
votes
1 answer

HtmlUnit throws NoSuchFieldError in WebClient.getPage

I installed HtmlUnit and wrote simple test program, to check that everything is working. So, here's my very simple test program with HtmlUnit: public class Main { public static void main(String[] args) throws Exception { WebClient…
elix x
  • 3
  • 3
0
votes
1 answer

Errors running HtmlUnit with Java

Attempting to use HtmlUnit. I want to input a username(pin) and password(password) and get to the next page. The output is a long list of errors. I am unable to post all the errors. However, the majority are duplicates. I've posted below each…
user5008526
0
votes
1 answer

How to always set correct number of tag before every run htmlUnit or Selenium test? Eclipse

I would like to ask you, if is possible to renumber (automatically) my tags in testing script before every start (Test defined in include) ... no shortcuts. My goal is always actual and right number of step in log.
0
votes
1 answer

get a HtmlTableDataCell with getFirstByXPath and a relative Xpath in HtmlUnit

I have some problems with HtmlUnit and the extraction of information from a website. At this website i find a table like this: …
0
votes
1 answer

HtmlUnit: setThrowExceptionOnScriptError(false) is not working

I am performing some test on a website, which is referring to a javascript array _gaq and it is not defined anywhere in the page. I can see the similar exception in Browser but there it is ignoring it. I set the method…
Sumit Kumar
  • 402
  • 1
  • 6
  • 26
0
votes
1 answer

Execute Javascript using Selenium or HtmlUnit

I need small help. I want to open some page using Java and Selenium or HtmlUnit, and after opening this page execute url like Ajax and get to String the response. Let say, a want to open http://www.somepage.com , when driver is still on this page,…
Ilkar
  • 2,113
  • 9
  • 45
  • 71
0
votes
1 answer

HtmlUnit Save Image Quality

I'm creating code to download some images from the web using HtmlUnit. But when I save the image with HtmlUnit the quality of the image is very low compared with the original image. I used this code to save the img url to a file. try { …
0
votes
1 answer

How to get input field values with htmlunit?

I'm working with java and htmlunit. I have this input in a web page:
Chris2141
  • 37
  • 3
  • 10
0
votes
0 answers

Get http proxy from HtmlUnit WebDriver from .pac proxy file

I have configured an HtmlUnitWebdriver to use a .pac to configure the autoproxy. Is there once I am navigating with the webdriver to return the specific http proxy that it is using? Code for webdriver below. public WebDriver htmlDriver(){ …
Kurter21
  • 63
  • 2
  • 8