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 3850966
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T17:05:26+00:00 2026-05-19T17:05:26+00:00

I have been messing around with HtmlUnit for a little bit and particularly this

  • 0

I have been messing around with HtmlUnit for a little bit and particularly this website because it has quite a few features that I wanted to get used to. I have posted about it before but that was mainly for grabbing information off the site which ended up successful. Now I am wanting to fill in a form and submit it.

Current Test Code:

def url = "http://www.hidemyass.com/proxy-list/"


client = new WebClient(BrowserVersion.FIREFOX_3)
client.javaScriptEnabled = false

page = client.getPage(url)
form = page.getFormByName("proxyform")

//get portInputField and set value
portField = form.getInputByName("p")
portField.setValueAttribute("80")

//select checkbox 1 & 2 from anonymity level
//click "Update Results"
//get new page url
//grab information
//save

The section commented out is where I am unsure of what to do. I went ahead and attempted but would like to ask for input on what I should be doing.

Attempt:

def url = "http://www.hidemyass.com/proxy-list/"

page = client.getPage(url)

portField = page.getHtmlElementById("ports").setValueAttribute("80")

submitButton = page.getByXPath("/html/body//form//input[@type='image']")
page2 = submitButton.get(0).click()

println page2    

The snippet above prints out: HtmlPage(http://www.hidemyass.com/proxy-list/search-1)@17168934

I’m looking to get a new page where I can then parse the information from the search. Any ideas?

I don’t believe the language I am using should make too much of a difference; however, I am using Groovy.

EDIT

I managed to get what I wanted but it returns like so:

HtmlPage(http://www.hidemyass.com/proxy-list/search-1)@23713629
<?xml version="1.0" encoding="UTF-8"?><td>109.123.00.00</td>

Is there a way to get only the information that I’m looking for : <td>109.123.00.00</td> or do I just need to strip the info from it manually?

EDIT

.asText() solved my issue, but gave quite a few warnings regarding the CSS. Should I be worried?

  • 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-19T17:05:26+00:00Added an answer on May 19, 2026 at 5:05 pm

    Is there a way to get only the
    information that I’m looking for :
    109.123.00.00 or do I just
    need to strip the info from it
    manually?

    This should work:

    def td = page2.getElementByName("td")
    assert td.textContent == "109.123.00.00"
    

    See the JavaDoc for HtmlPage for other ways to extract information from a page. Don’t parse the page manually.

    Side note: Since you are already using Groovy, you could also have a look at Geb, a popular Groovy-based web automation and testing tool that’s more convenient to use than HtmlUnit.

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

Sidebar

Related Questions

I've recently taken the plunge into DirectX and have been messing around a little
I have been messing around with synchronization in Java and it has yet to
I have been messing around with recursion a few hours and just cant get
I have a tricky problem that I've been messing about with for a few
I have been messing around with recursion today. Often a programming technique that is
I have been messing around with iTunes COM from python. However, I haven't been
I have been messing around with writing some stored procedures in .NET code with
I have been messing around with Leaks trying to find which function is not
Okay, I have been messing around with different sorting algorithms in Ruby; mainly variations
i am haveing some problems with JSON and arrays. I have been messing around

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.