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

  • Home
  • SEARCH
  • 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 6090139
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:10:47+00:00 2026-05-23T12:10:47+00:00

I found it very difficult to work with htmlunit in terms of creating new

  • 0

I found it very difficult to work with htmlunit in terms of creating new html content on the fly like we can do in jquery.

For example given a text node:

I am text

I want change that text node into (if the word is greater than 3 chars it is replaced
with span):

I am <span>text</span>

After this I want to replace the original text node ( I am text) with

I am <span>text</span>

in the html document wherever it occurred.

So how can I achieve this using htmlunit? Is there better alternative to htmlunit in Java applications for screen scraping or modify dom on the fly type of applications?

In htmlunit I could not even find how to construct a new element as constructors are mostly missing or declared protected.

  • 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-23T12:10:47+00:00Added an answer on May 23, 2026 at 12:10 pm

    It’s not clear what you want to do exactly, but HtmlUnit is a programmatic browser. Its API allows doing in Java what a user would do with his keyboard and mouse in a standard browser. And modifying the DOM of a web page is not what a user does with his browser.

    Its API allows accessing the DOM tree anyway (though not via the W3C DOM interfaces), and you should thus be able to do in Java what you would do in JavaScript with the DOM. HtmlElement instances can be created through the createElement method of HtmlPage. But of course, there is no “JQuery in Java for HtmlUnit”.

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

Sidebar

Related Questions

I found it very difficult to configure linked resource in Eclipse CDT. Folder wspolne
I've found it very difficult to find any existing documentation on this. What I'm
I am just trying to get into python, but I've found it very difficult
One thing I have continually found very confusing about using an object database like
It's very difficult to find this kind of document online. I found one in
I'm having a very difficult time understanding how a c# form can populate and
I found it very hard to customize PDF invoice that Magento use. Not only
I found a very interesting memory leak detector by using Visual C++. http://www.codeproject.com/KB/applications/visualleakdetector.aspx I
I haven't found a very good answer to my problem so I'm starting a
As a programmer I found it very hard to use my laptop and workstation

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.