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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T13:53:16+00:00 2026-05-16T13:53:16+00:00

There is a web page from which I want to retrieve a certain string.

  • 0

There is a web page from which I want to retrieve a certain string. In order to do so, I need to login, click some buttons, fill a text box, click another button – and then the string appears.

How can I write a java program to do that automatically? Are there any useful libraries for that purpose?

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-16T13:53:17+00:00Added an answer on May 16, 2026 at 1:53 pm

    Try HtmlUnit

    HtmlUnit is a "GUI-Less browser for
    Java programs". It models HTML
    documents and provides an API that
    allows you to invoke pages, fill out
    forms, click links, etc… just like
    you do in your "normal" browser.

    Example code for submiting form:

    @Test
    public void submittingForm() throws Exception {
        final WebClient webClient = new WebClient();
    
        // Get the first page
        final HtmlPage page1 = webClient.getPage("http://some_url");
    
        // Get the form that we are dealing with and within that form, 
        // find the submit button and the field that we want to change.
        final HtmlForm form = page1.getFormByName("myform");
    
        final HtmlSubmitInput button = form.getInputByName("submitbutton");
        final HtmlTextInput textField = form.getInputByName("userid");
    
        // Change the value of the text field
        textField.setValueAttribute("root");
    
        // Now submit the form by clicking the button and get back the second page.
        final HtmlPage page2 = button.click();
    
        webClient.closeAllWindows();
    }
    

    For more details check:
    http://htmlunit.sourceforge.net/gettingStarted.html

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

Sidebar

Related Questions

I want to retrieve some data items from a web page. Link of webpage:
In my web page header, there are several buttons. What I want is to
I'm using domdocument() to retrieve data from a web page, and I want to
I want to know which city a visitor of my web page comes from
in web page ,image control and file upload are there.if click file upload and
When in a method of a controller I need to retrieve some data from
I have Default.aspx page, which inherits from BasePage.cs, which inherits from System.Web.UI.Page. BasePage is
There is a time table in my web page, I want the user to
I want to identify from where a visitor coming to my webpage.Is there anyways
Is there any way to save complete web-page using WebDriver? Currently I do getPageSource()

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.