Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7180155
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T17:17:20+00:00 2026-05-28T17:17:20+00:00

I’m trying to use HtmlUnit to test that my GWT website loads properly. Unfortunately,

  • 0

I’m trying to use HtmlUnit to test that my GWT website loads properly.

Unfortunately, the page I’m fetching doesn’t seem complete. It is missing content which is viewable when I visit the page in my normal browser.

Here’s my unit test that is producing this output:

WebClient webClient = new WebClient();
webClient.setThrowExceptionOnScriptError(false);

webClient.setAjaxController(new NicelyResynchronizingAjaxController());
webClient.waitForBackgroundJavaScript(30000);
HtmlPage page = webClient.getPage("http://www.ozdroid.com/#!BLOG/2010/10/12/How_to_Make_Google_AppEngine_Applications_Ajax_Crawlable");

System.out.println(page.asXml());
webClient.closeAllWindows();

Does anyone have any idea what I can do to get around this and fetch the full Html of the site?

Edit

Here’s what the page.asXml() returns with the updated code, which is clearly incomplete:

<?xml version="1.0" encoding="ISO-8859-1"?>
<html xmlns:fb="http://www.facebook.com/2008/fbml>
&lt;head>
&lt;meta http-equiv=" content-type="">
  <head>
    <meta name="google-site-verification" content="_KCG8ec0LvgmXjnBAikAog0knc7jAbIGCu8Cmu2hsCI"/>
    <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7"/>
    <link rel="shortcut icon" href="favicon.ico"/>
    <link rel="icon" type="image/gif" href="favicon.gif"/>
    <title>
      OzDroid - Enterprise Solutions for Android | Laser Barcode
scanners | RFID | Handheld Computers | Rugged PDA's and Mobile Phones
    </title>
    <script type="text/javascript">
//<![CDATA[
var _gaq = _gaq || [];
//]]>
    </script>
    <script type="text/javascript" language="javascript" src="ozdroid/ozdroid.nocache.js">
    </script>
    <script defer="defer">
//<![CDATA[
ozdroid.onInjectionDone('ozdroid')
//]]>
    </script>
    <script src="http://www.google-analytics.com/ga.js" type="text/javascript">
    </script>
  </head>
  <body>
    <!-- OPTIONAL: include this if you want history support -->    <iframe src="javascript:''" id="__gwt_historyFrame" style="position: absolute; width: 0; height: 0; border: 0">
    </iframe>
    <noscript>

&lt;div
    style="width: 22em; position: absolute; left: 50%; margin-left: -11em; color: red; background-color: white; border: 1px solid red; padding: 4px; font-family: sans-serif"&gt;
&lt;p&gt;Welcome, to the website of OzDroid, we sell and distribute rugged Android
 handheld computers, pda's and mobile phones. These devices can be equipped 
 with options including 1D and 2D laser barcode scanners, RFID, wifi,
  bluetooth and cameras.&lt;/p&gt;
 &lt;p&gt; In the near future, we also
 will be supplying logistics software for the same.
&lt;/p&gt;
&lt;p&gt;As this site contains dynamic content that relies on javascript,
 &lt;b&gt;your web browser must have JavaScript enabled&lt;/b&gt; in order for this site to
display correctly.
&lt;/p&gt;&lt;/div&gt;

    </noscript>
    <div id="fb-root">
    </div>
    <!-- Production -->    <script src="http://connect.facebook.net/en_GB/all.js">
    </script>
  </body>
</html>

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T17:17:21+00:00Added an answer on May 28, 2026 at 5:17 pm

    Cuga the website you are are trying to fetch is mine, it was basically a bit of overkill when I was learning some GWT stuff and wanted to make the site crawlable. The idea was to make a simple blog so that I could have dynamic content crawled. The blog articles are fetched from appengine datastore using RPC calls, so it was a useful test.

    The full HTML is served by the site by complying with Googles Ajax crawling standards and replacing #! with ?_escaped_fragment_= .

    The address below should fetch the page from App Engine

    Link

    All the work done to generate the HTML snapshot on the appengine server is done by HTMLUnit. So its not likely to be a HTMLUnit bug.

    Unfortunately some of the facebook type stuff is now broken – I suspect due to to API changes – but to be honest I really haven’t looked as I have other priorities.

    AS I haven’t touched this for over two years I am a bit rusty…

    TRY THIS

    put the line…

    webClient.waitForBackgroundJavaScript(30000);
    

    after getting the page. I think waitForBackgroundJavaScript() is supposed to block the thread you are on until all the javascript has ran. Calling it before you fetch the page probably does nothing.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically, what I'm trying to create is a page of div tags, each has
I am trying to understand how to use SyndicationItem to display feed which is
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
I'm trying to create an if statement in PHP that prevents a single post
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I used javascript for loading a picture on my website depending on which small
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.