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 not working with Ajax/Javascript

I am trying to extract data for a class project from a webpage (a page that shows search results). Specifically, it's this page:…
0
votes
1 answer

How to filter responses types in HtmlUnit?

While crawling a webpage I am getting various response types (image/text/html/json/css/js etc). I only need the .json files not the other ones. How can I filter other response types using HtmlUnit? Problem is: The required data is stored in a…
Shashank
  • 712
  • 15
  • 33
0
votes
1 answer

How to select the specific element using HtmlUnit with java?

I am using Java+HtmlUnit to test my Java-GWT project. I have an element like this: OCP in the source code of my generated html page. How can I select it using XPath (or with any another…
0
votes
1 answer

Automate google login and download app statistic

So currently i have a scraping program that logs into a google account and grab application data from google play developer console (downloads, ANR, crashes, etc.). I use java and HTMLUnit library for the scraper. Here is a snippet for the login…
Aldibe
  • 1,277
  • 2
  • 11
  • 16
0
votes
1 answer

Selenium getText() not working on htmlunitdriver

I looked around and couldn't find an specific answer that helped me figure out what's happening in my code. I'm running a selenium webdriver test using the htmlunitdriver . I'm just uploading a picture on photobucket for learning purposes. I've used…
0
votes
1 answer

How to implement a class holding connections to website, each in separate thread simultaneously?

I am using HTMLUnit in java as a "browser" for accessing my website. This is what I am trying to achieve: log into my website under different usernames at the same time keep all connections alive and for each user do different authorized requests…
matty
  • 361
  • 3
  • 9
0
votes
1 answer

HtmlUnit Page response (Downloading File)

So im trying to use HtmlUnit to go to a URL but once you visit that url it downloads a json file regarding the data you want. Not sure how to word this but basically in HtmlUnit how can I get the result from a downloaded file. I suck at explaining…
0x2B
  • 91
  • 9
0
votes
1 answer

How to "get around" steam login while using HtmlUnit?

I want to write a java program which can browse webpage associated with steam. The problem is that I don't understand how steam automatically logs in users. I figured these services use some kind of a cookies, but i couldn't find those cookies in…
valikund
  • 25
  • 7
0
votes
1 answer

HtmlUnit Post form?

Hey Im trying to use HtmlUnit to login a page. Login form is different from login button form. I got the login form working but the form the login button is in is something like this
0x2B
  • 91
  • 9
0
votes
2 answers

HtmlUnit on Moodle: FileUpload fails despite success message

I try to upload a file to a moodle2 container. This is done via yui. To skip this stuff I disable java script in my WebClient (browser) to get the "noscript" elements. After analysing these I get to a page where the filepicker.php of moodle is…
0
votes
1 answer

PatternSyntaxException when trying to access Website with HtmlUnit

I'm currently trying to acces a Webpage in Javacode using HtmlUnit. The Page has a Button, which opens a new Page when clicked. But when I try to click it, the compiler throws this exception which can be found in the attached image. As far as I…
PooBucket
  • 63
  • 1
  • 1
  • 7
0
votes
2 answers

Disable automatic Date parsing in HtmlUnit

Having just upgraded to a newer version of HtmlUnit (2.4), I've noticed certain tests are failing when comparing the output of asText. Looking into the differences, this is because dates (present on the page in the format 11/06/2010 00:00z) are…
Submonoid
  • 2,809
  • 2
  • 20
  • 25
0
votes
1 answer

Java: HTMLUnit - Click on a Javascript Button

Good evening everyone, I got the following problem: I programmed an automated test-system for some websites. Now I have the problem that I must press a specific button at some time in a test case. Unfortunately, the button isn't a normal button. I…
user4465319
0
votes
1 answer

Trying to use HTML Unit through unix server

My Java code using html unit is working perfectly fine as I need to open a webpage and fill a form and finally click submit. But when I tried to deploy Java code Jar in Unix, it's unable to find and click on the text input fields/buttons. So please…
RendezAWS
  • 103
  • 9
0
votes
1 answer

Convert cookies from HTMLUnit to HTTPBuilder?

I am doing this (in Groovy): def cookies=webClient.cookieManager.cookies def http=new HTTPBuilder("myurl") http.request(POST) { def headersCookie='' cookies.eachWithIndex() { cookie,i-> if (i>0) { headersCookie+='; ' } …
Миша Кошелев
  • 1,483
  • 1
  • 24
  • 41
1 2 3
99
100