htmlunit

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 wait while loading screen' for reports. The page opens a new window then redirects back ...

Turning HtmlUnit Warnings off

Do you know how can I turn Warnings, Notes, Errors in HtmlUnit off? ...

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

Hi, 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 DomChangeListener (for added or removed nodes) and a HtmlAttributeChangeListener bu...

How do I make my AJAX content crawlable by Google?

Hi all. I've been working on a site that uses jQuery heavily and loads in content via AJAX like so: $('#newPageWrapper').load(newPath + ' .pageWrapper', function() { //on load logic } It has now come to my attention that Google won't index any dynamically loaded content via Javascript and so I've been looking for a solution to th...

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? ...

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 use a Google Voice number to avoid buying an actual phone number. Any ideas? I've thought ...

HtmlUnit and XPath: DOMNode.getByXPath only works on HtmlPage?

I'm trying to parse a page with links to articles whose important content looks like this: <div class="article"> <h1 style="float: none;"><a href="performing-arts">Performing Arts</a></h1> <a href="/performing-arts/EIF-theatre-review-Sin-Sangre.6517348.jp"> <span class="mth3"> <span id="wctlMiniTemplate1_ctl00_ctl00_ctl01_...

What Exception is thrown on timeout ?

What Exception is thrown on connection timeout in HTMLUnit ? ...

How to get load times of different resources (JS/CSS/Images) on a webpage (on a server)?

Given a URL, on a server (preferably Linux), I'm interested in finding out load times of all different resources loaded by that URL. These resources would be JavaScript/CSS/Images, etc. (I can't simply scrape a page because many of these resources are loaded by JavaScript, say using document.write) Basically, I want to get the informatio...

How to remove elements of a page in htmlunit

Normally in PHP, I would just parse the old document and write to the new document while ignoring the unwanted elements. ...

Geb functional web tests + cookies

I've been having issues with testing my Grails application's authentication. It appears that the browser won't accept cookies, so I created a simple grails application as a test. <html> <head> <title>Welcome to Grails</title> </head> <body> <g:each in="${request.cookies}"> <h1>${it.name} = <span class="value">${it.value}<...

app engine support for HtmlUnit

I'm trying to use HtmlUnit to get DOM of webpages. However, when I try to run this code on app engine development server (using the eclipse plugin): WebClient wc=new WebClient(); HtmlPage page1= wc.getPage("http://ww.google.com/"); I get this exception: java.net.URLStreamHandler is a restricted class. Is it not possible to use Htm...

How do I click a javascript button with htmlunit?

I'm working on an application that will automatically click a button on a webpage using htmlunit in Java. Only problem is that that button is a javascript button, so the standard getInputByName() won't work. Any suggestions with dealing with this? The code for the button is included below. <a class="vote_1" id="1537385" href="/javascrip...

Does this unit test have to be in the same package as the controller it tests?

According to this example, it goes in the same package as the controller it tests. Why is that necesssary? I think it would be tidier to have all of my unit tests in a testing package - would there be a problem with doing so? package com.example.web.controllers; ...imports... @RunWith(SpringJUnit4ClassRunner.class) @ContextConfigur...

form submit returns blank page

Hi, I am having problems getting the page that a form generates when clicking on a button. The form has a text field where I introduce a value, then I click on a button that shows a third button which, when clicked, opens a new window and shows a page (in AJAX I think). I set the valueAttribute of the text field and then I click on the ...

Groovy, Grape and HtmlUnit

Hi folks! 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 com.gargoylesoftware.htmlunit.* def client = new WebClient(BrowserVersion.FIREFOX_2...

Groovy htmlunit

I'm having issues importing htmlunit (htmlunit.sf.net) into a groovy script. I'm currently just using the example script that was on the web and it gives me unable to resolve class com.gargoylesoftware.htmlunit.WebClient The script is: import com.gargoylesoftware.htmlunit.WebClient client = new WebClient() html = client.getPage('htt...

Jwebunit and Wordpress

Hi, I'm trying to login to my website which runs on wordpress using Jwebunit. webPage.setBaseUrl("http://www.mywebsite.com"); webPage.beginAt("/wp-login.php"); webPage.setTextField("log", "myusername"); webPage.setTextField("pwd", "mypassword"); webPage.clickButton("wp-submit"); The above does not throw any errors, but the page does...