htmlunit

How to get base64 encoded contents for an ImageReader?

Hi. How do I read an image into a base64 encoded string by its ImageReader? Here's example source code using HtmlUnit. I want to get the base64 String of img: WebClient wc = new WebClient(); wc.setThrowExceptionOnFailingStatusCode(false); wc.setThrowExceptionOnScriptError(false); HtmlPage p = wc.getPage("http://flickr.com"); ...

Want to add popup entry in Allow popup option of firefox using javascript

Hi Guys , I want to add popup blocker entry for the specific site in htmlunit webclient we can do it manually by clicking to edit popup blocker entry option in browser but how to do it in htmlunit is it possible ? if yes ......how? I want to do this in htmlunit Thanks ...

Is there a way to visually see if htmlunit is performing the correct commands?

Is there a way to visually see if htmlunit is performing the correct commands? I have a hard requirement to use htmlunit. I just don't know if it's filling out all the form correctly. ...

How do I define a new entity for the HtmlUnit XML parser?

I'm running into an issue with the HtmlUnit parser where I'm trying to grab some XML from a website (using the website's API) do a quick parse of the resulting XML and then save the XML to a file (all within the rights of the API). (sample content) Unfortunately the website returns an entity ¿ in some of the requested pages, and...

Please help me to convert this java code to C#

I'm using Htmlunit in my C# project, but I cannot convert this code in java to C# webClient.setWebConnection(new HttpWebConnection(webClient) { public WebResponse getResponse(WebRequestSettings settings) throws IOException { System.out.println(settings.getUrl()); return super.getResponse(settings); } }); Can an...

Getting the Text of a webpage with HtmlUnit?

hi all, I'm just getting started with HTMLUnit and what I'm looking to do is take a webpage and extract out the raw text from it minus all the html markup. Can htmlunit accomplish that? If so, how? Or is there another library I should be looking at? for example if the page contains <body><p>para1 test info</p><div><p>more stuff here</...

Impossible site for HtmlUnit?

I cannot, for the life of me, rig HtmlUnit up to grab this site: http://www.bing.com/travel/flight/flightSearch?form=FORMTRVLGENERIC&amp;q=flights+from+SLC+to+BKK+leave+07%2F30%2F2010+return+08%2F11%2F2010+adults%3A1+class%3ACOACH&amp;stoc=0&amp;vo1=Salt+Lake+City%2C+UT+%28SLC%29+-+Salt+Lake+City+International+Airport&amp;o=SLC&amp;ve1=...

Java: how to setup htmlunit

I'm a pretty big noob to Java, but I would like try out htmlunit. I'm using netbeans as my IDE and I've created a project folder "hu1". Here is the structure for that folder: hu1 > nbproject > src > hu1 > test Now, I download htmlunit 2.7 and unzipped the folder, which contains a "lib" folder with a bunch of jar files in it. ...

Ajax Crawling on Google App Engine - Does HtmlUnit work?

http://code.google.com/web/ajaxcrawling/docs/html-snapshot.html Does HtmlUnit work on AppEngine? If not, are there any other ways to make my GWT app crawlable by search engines? ...

How can I test context menu functionality in a web app?

I'm playing with a grails app that has a contextmenu (on right-click). The context menu is built using Chris Domigan's jquery contextmenu plugin. While the contextmenus do actually work, I want to have automated tests, and I can't work out how to do it. I've tried Selenium 2.05a (ie. Webdriver), but there's no rightClick method. I not...

How to apply .diff patch with Eclipse to HtmlUnit

I'm trying to patch HtmlUnit with the patches at the bottom of this page. I can see how to apply patches from Eclipse, but I can't figure out how to apply these particular patches. I had the JARs initially, but then I realised I'd need to source, so I obtained those, but still no luck. In the patch I see: --- a/htmlunit/src/main/java/...

Java HTMLUnit - How do I access the page DOM I'm sent to after submitting a form

I'm very confused on how to access the newly loaded page's DOM after I .click() the submit button on a page and am sent to another one. Any ideas? Thanks. ...

How to get Atomic Value between Element Nodes using XPath

I want to select only the atomic values inside a node. For example, the "here" text in the following: <a href="">here</a> When I use Xpath in Java, it returns some sort of object/array, such as [DomNode[<a href="">here</a>]] I just want the text only. Is this possible, and how? Thanks! ...

How to send a picture as part of a multipart POST request - Java HtmlUnit

I am trying to use Java to submit a captcha to decaptcher.com. Decaptcher doesn't really do a good job of explaining how to use their API's, so I am trying to figure out how to use an HTTP POST request to submit a captcha. Here is the example code I got from their website: <form method="post" action="http://poster.decaptcher.com/" ...

Does HTMLUnit load images when it browse page ?

as above. Does it? ...

HtmlUnit - ElementNotFound Exception

I'm using HtmlUnit [see this], and I bumped into a weird problem: I'm trying to call a page, click a button and retrieve the subsequent page. It works fine, but sometimes it bumps out with ElementNotFoundException when I try setting the value attribute for a field in the retrieved page. I tried adding a Sleep(1000), but it doesn't help....

How do I add username / password authentication information in a HtmlUnit test case ?

Hi, I am accessing an svn repository via http protocol. When I put in the url into Internet Explorer, it prompts me with a dialog box for username / password and then the file loads up correctly in the browser. What I need to do is download a ton of files from different tags from this svn repository. I was trying to automate downloa...

Making AJAX Applications Crawlable? How to build a simple web service on Google App Engine to produce HTML Snapshots?

Real World Problem: I have my app hosted on Heroku, who (to my knowledge) are unable to offer a solution for running a Headless (GUI-less) Browser - such as HTMLUnit - for generating HTML Snapshots for Googlebot to index my AJAX content. My Proposed Solution: If you haven't already, I suggest reading Google's Full Specification for M...

How to get htmlunit to recognize dynamically updated html code

So I have a page in Windchill 9.1 that has a dynamic popup of a drop-down menu with a z-index of a 100. And for some reason the popup doesnt show up in the source code. Using firebug I can see that the html code is being dynamically added onto the page and when I close out from the menu, the code becomes a lighter shade in firebug (may...

Unable to submit form programmatically using HtmlUnit

Hi, 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 WebClient(com.gargoylesoftware.htmlunit.BrowserVersion.INTERNET_EXPLORER_6); client.setJavaScriptEnabled...