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

ActiveMQ 5.14.1 conflicts with htmlunit and jquery

I recently upgraded ActiveMQ to 5.14.1 from 5.11.1. My application having some UI tests written with the help of htmlunit and the tests were running fine before the up-gradation. Once after upgrading the ActiveMQ, i am seeing full of warnings while…
rakeeee
  • 973
  • 4
  • 19
  • 44
0
votes
1 answer

Getting the value of td element in htmlunit

hi re hello I have DOM element structure as shown above. Using htmlunit, i want to extract the value "hello" only, given that i have HtmlElement object referring to "td" node. I tried using…
user3247895
  • 473
  • 1
  • 6
  • 14
0
votes
1 answer

HtmlUnit: opening new page with the same WebClient

I am trying to parsing a website wiht HtmlUnit and Jsoup and i facing this problem. I have different pages to parse and I stored this links of this pages in a string array. I want to loop on array's length and parse each page and i proceed in this…
0
votes
1 answer

Jsoup, HTMLUnit, phantomJS: How can I click on Button OR fill out Formular TO bypass agecheck

I collected URLs from a mainpage (Steam-GameStore) and want to call each single site, but some of them have an agecheck. I identified two different types of agechecks: only a simple button is expected to click a whole table has to be filled…
fasswas
  • 61
  • 1
  • 9
0
votes
1 answer

HtmlUnit - Getting button from form

I am trying to log in to facebook using HtmlUnit library: String loginURL = "https://www.facebook.com/login.php?login_attempt=1" final WebClient webClient = new WebClient(); HtmlPage page1 = webClient.getPage(loginURL); final HtmlForm form =…
Wicia
  • 575
  • 3
  • 9
  • 28
0
votes
1 answer

Get all tr on page by class

I need to get all tables with some class, and get all id of rows with some class in this tables. My code is next: HtmlPage page = webClient.getPage("http://www.somesite.com"); HtmlTable table = div.querySelector(".table-classname"); for…
intacto27
  • 9
  • 1
0
votes
1 answer

Groovy, Grape and HtmlUnit

could someone instruct me how to Grape-include HtmlUnit in a Groovy (1.7.5) script so that it actually works? Here's what I'm doing: @Grapes([ @Grab('net.sourceforge.htmlunit:htmlunit:2.8'), @GrabExclude('xml-apis:xml-apis') ]) import…
Matthias Hryniszak
  • 3,099
  • 3
  • 36
  • 51
0
votes
1 answer

How to login into the site using form data in Htmlunit

How to login to site which has the below form data, the submit does't have name or id String URL="http://127.0.0.0/zero/login.jsp"; final HtmlPage resultPage = webclient.getPage(URL);
Gan
  • 197
  • 1
  • 4
  • 19
0
votes
1 answer

How to submit button without name or value

Gan
  • 197
  • 1
  • 4
  • 19
0
votes
1 answer

How to get info from website once logged on with HTMLUNIT?

I have made a post before about this but have gained some more details on how to do it, yet i am still unable to do it properly. This is the main part of code. When i run it i get a whole bunch of warnings related to css in the console. And it wont…
Vijay
  • 1
  • 2
0
votes
1 answer

How can I parse a table from a webpage in Java?

I am trying to parse the link http://finance.yahoo.com/quote/VZ/key-statistics?p=VZ with code below and page does not load completely . I have tried using webClient.waitForBackgroundJavaScript(500000); & Thread.sleep(1000); with out any success . My…
0
votes
1 answer

fill a form in a asp dynamic page with htmlunit

I'm making a little script in java to check iPhone IMEI numbers. There is this site from Apple : https://appleonlinefra.mpxltd.co.uk/search.aspx You have to enter an IMEI number. If this number is OK, it drives you to this page :…
saperlipopette
  • 177
  • 1
  • 12
0
votes
1 answer

Clicking a button with HtmlUnit not working

I am trying to click a login button using HtmlUnit 2.23, using either DomElement or executeJavaScript but none of it works. Is there any other way to get it working? This is the code: @Test public void noLogin() throws Exception { final…
Würgspaß
  • 4,660
  • 2
  • 25
  • 41
0
votes
0 answers

HtmlUnit - code works on my own system, not on my VPS?

I have written some code to automate a certain task I want to perform and it works fine on my computer. Since this task has to be executed every hour, I am running it on my VPS (Amazon). But running the code on my VPS gives me most of the times…
0
votes
0 answers

HtmlUnit send parameters to javascript file

I used the following code for a post request with htmlunit final WebClient webClient = new WebClient(); WebRequest requestSettings = new WebRequest(new URL("www.URLHERE.com"), HttpMethod.POST); requestSettings.setRequestParameters(new…
dracodormiens
  • 510
  • 4
  • 21