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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T19:43:59+00:00 2026-06-13T19:43:59+00:00

i have project in web by automate a website, input data, after that submit

  • 0

i have project in web by automate a website, input data, after that submit this site and get data when it’d responed. surf in google and i’ve decided choose the best acticle in codeproject using Webbrowser Control.

http://www.codeproject.com/Articles/50544/Using-the-WebBrowser-Control-in-ASP-NET

There a so much problems which i can not trace and try alot by finding solutions by google, but nothing change.

The site i want to extract data have the submit form as below:

<form id = "ctl103">
  <input type="radio" id="rdoFlightTypeReturn" name="rdoFlightType"   
                      value="return" checked="checked"/>

  <input type="radio" id="rdoFlightTypeOneWay" name="rdoFlightType" 
                  value="oneway" />
  <input name="so long" type="text" id="txtOrigin" autocomplete="off" />
  <input name="very much" type="text" id="txtDestination" autocomplete="off" />
  <input type="text" id="txtDepart" autocomplete="off" name="txtDepart"/>  
                                                       //dd/mm/yyyy format
  <input type="text" id="txtReturn" autocomplete="off" name="txtReturn" /> 
                                                       //dd/mm/yyyy format 
  <button type="submit" class="png-bg" id="btnSearchForFlights">Search Flight</button>
</form>

The code i write to submit this form:

void IEBrowser_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
    HtmlDocument doc = ((WebBrowser)sender).Document;

    if (doc.Title.Equals("Home") && loginCount++ < 3)
    {   try
        {
            HtmlElement element = doc.GetElementById("rdoFlightTypeOneWay");
            element.InvokeMember("click");
            } 
        catch {
            ieBrowser.Navigate("http://www.my---favoritesite.com");
            return;
        }
        doc.GetElementById("txtOrigin").InnerText = "SGN";
        doc.GetElementById("txtDestination").InnerText = "HAN";
        doc.GetElementById("txtDepart").InnerText = "03/11/2012";
        doc.InvokeScript("setTimeout", new object[] { "submitFlights()", 20 });

    }
    else
    {

        doc.InvokeScript("setTimeout", new object[] {   
        string.Format("window.external.getHtmlResult({0})", navigationCounter), 10 });
    }
}

The problem is:

Some time it’s work, very usually when few first time i run the project, but after that, it’s not ok. I thinks the reason was i can not submit or Postback wrong way, so i try something like that:

HtmlElement button_searchFlight = doc.GetElementById("btnSearchForFlights");
button_searchFlight.InvokeMember("click");

or

mshtml.HTMLAnchorElementClass obj =   
(HTMLAnchorElementClass)button_searchFlight.DomElement;
obj.click();

or

mshtml.HTMLButtonElementClass button1 =  
(mshtml.HTMLButtonElementClass)button_searchFlight.DomElement;
button1.click();

or

doc.InvokeScript("submitFlight()");

or
doc.GetElementById(“ctl03”).InvokeMember(“submit”);

all those stuff go wrong or reset the form or do nothing, so i’ve come back with

doc.InvokeScript("setTimeout", new object[] { "submitFlights()", 20 });

to submit the form.

Note: one thing so strange is: when i finding in the web, i’ve founded “submitFlight()” can work. It fired the bookNow() and after that, the bookNow() fired another script “formsubmit()”, but i can not find the “formsubmit()” anywhere in source code including some other javascript link to the page.

Because i’ve successed sometime to run the project, and now, it also do not post any data to the site, so i think the problem may be in cookies which the site set before. I’ve go to IE (internet explorer) to delete all cookies. After that, the code worked again to submit input data but do wrong way. I’ve founded that some cookies still set, it was about the old state of textbox”txtDepart” set “1/11/2012”

All i can figured out my problem may be about the javascript oF the site or/and the cookies it set.

(sorry because my poor English)

  • 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-06-13T19:44:01+00:00Added an answer on June 13, 2026 at 7:44 pm

    Try using WatiN to do the web automation. Many of these tasks are wrapped for you.

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

Sidebar

Related Questions

I have a dynamic web project (JSP) on Eclipse that runs on a tomcat
I have a web project that I am ripping out all the inline styling
I have an Eclipse web project that was working perfectly fine until I converted
I have a project (Web Application) that I need to implement with Web Forms.
I have a web application that I'm trying to create a Web Deployment Project
We have a project (Web/PHP) where we would like users to access their files,
I have a web project in Asp.net MVC where in many pages, there is
I have a web project with devexpress component ASPxGridView. So I want to know
I have a web project working perfecly on my web server and on my
I have a project involving a web voting system. The current values and related

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.