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 automate a text message?

I have a group that needs to send out announcements and current events via phone text message. I want to have a central phone number that when it receives a text message, it rebroadcasts that message to a growing list of subscribers. I'm hoping to…
Coldblackice
  • 3,450
  • 4
  • 21
  • 22
0
votes
1 answer

HTMLUnit how to check if proxy is working properly

Do you know what can I do to check if proxy in WebBrowser is working properly?
oneat
  • 10,778
  • 16
  • 52
  • 70
0
votes
1 answer

xPath on HtmlTableRow (HtmlUnit) does not work properly

I am using getFirstByXPath on a HtmlTableRow with HtmlUnit, but it does not work properly. If i log the HtmlTableRow asXml() Half Day Tour to the Rhine…
user3287019
  • 311
  • 5
  • 18
0
votes
1 answer

Login to LinkedIn using HtmlUnit and navigate to Connections Web page

Currently I am trying to login to LinkedIn using HtmlUnit 2.20. But I am not able to login. Below is my code. public static void Login(String username, String password) { final WebClient webClient = new WebClient(BrowserVersion.CHROME); …
user2475467
  • 129
  • 1
  • 10
0
votes
1 answer

How to get ajax-updated text values on a webpage in HtmlUnit?

I have a website here which is continuously updated by Ajax. I'm using HtmlUnit in Java and need to get the updated text values but I don't know how. For example: TextValue. When "TextValue" changed, how can I access the new value? I know there is a…
0
votes
1 answer

How can i scrape javascript code only present b/w two comments by HtmlUnite?

I'm using htmlunite to scrape data from websites.I want to scrape the javascript code present b/w two comments as shown in pictures using htmlunite.Answer soon as possible I need it now so badly.This picture is taken from source page of site
0
votes
0 answers

HTMLUnit Angular JS Seo not populating UI-VIEW from state change

I am using htmlUnit headless browsing for creating static content of my page automatically. But due to some reason my page is not getting the sub-child of ui-view inside it Below is the code try (final WebClient webclient = new…
Puneet
  • 11
  • 1
  • 3
0
votes
1 answer

HtmlUnit stops JavaScript execution after a window.open

I've recently updated from HTMLUnit 2.4 to 2.5 (we'd go for the latest version but there is a lot of code to refactor due to the deprecated APIs). I'm now having a problem with some JavaScript that opens a window. The page under test, is a 'Please…
Jason Gritman
  • 5,251
  • 4
  • 30
  • 38
0
votes
1 answer

Unable to submit form programmatically using HtmlUnit

I'm using HtmlUnit in a Groovy script to get a csv file from the www.goodreads.com site. This script used to work until recently, where some strange SSL error appeared. Here is the used Groovy code WebClient client = new…
Riduidel
  • 22,052
  • 14
  • 85
  • 185
0
votes
1 answer

ArrayList data needs to be represented in JTable

I am new relatively new to Java programming, but what I am trying to do is getting some data from website via HtmlUnit using java and I successfully managed to do that , but I need to represent this data in JTable and that is where I am lost. I have…
IIvanov
  • 1
  • 2
0
votes
0 answers

Groovy HTMLUnit Error - Caught: java.lang.NoSuchMethodError: com.steadystate.css.parser.CSSOMParser.parseMedia

I am getting this error in a groovy script: Caught: java.lang.NoSuchMethodError: com.steadystate.css.parser.CSSOMParser.parseMedia(Lorg/w3c/css/sac/InputSource;)Lorg/w3c/css/sac/SACMediaList; java.lang.NoSuchMethodError: …
0
votes
1 answer

Clicking a link using htmlunit (Java)

I'm trying to get htmlunit to click the second link (Contacts) in a page:
0
votes
1 answer

Java Logging in to a website that uses complex javascript

I'd first like to start by saying, I've managed this using phantomJS and Selenium. I load phantomjs, load the url (sports.coral.co.uk) and then check my balance. I am however trying to find a more lightweight option. I have tried manually sending…
Adam.J
  • 2,519
  • 3
  • 14
  • 12
0
votes
1 answer

HtmlUnit (junit) me is returning an error in the code

first anything clarified that I am using Google Translator. I am Hispanic. not be much English Well, said you what I need to do I'm trying to make this code work but it gives me an error, note that I am putting as same ta at the official…
0
votes
0 answers

Java: access to website refused with htmlunit

I am trying to access a webpage on a Virtual Machine with Htmlunit/webclient etc. My code is doing just this for the time being. When I run the program, I get the following error: Exception in thread "main"…
Java dev
  • 89
  • 1
  • 1
  • 7