By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,839 Members | 2,270 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,839 IT Pros & Developers. It's quick & easy.

automatically post data & click buttons on sequence of web pages with AxWebBrowser

P: n/a
automatically post data & click buttons on sequence of web pages with
AxWebBrowser

Hi, I need to post stuff everyday to a website and am working on a VB
program to do this for me. I am a computer technician and I post an ad
on craigslist.org everyday but sometimes I don't have time to do this.

So, I accomplished so far to load the first page and post my ad in the
textbox, with title and email address, and to alter the radio button
and to click the submit button. But when the next page loads, my code
to press on the submit button on that page generates an error "An
unhandled exception has occured in your application... Press Continue
or Quit".
All I have in my program is the main form with a web browser control,
then the code in the AxWebBrowser1_Enter subroutine. Here it is:

Private Sub AxWebBrowser1_Enter(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles AxWebBrowser1.Enter

AxWebBrowser1.Navigate("http://post.craigslist.org/nyc/B/cps/mnh")
Do While AxWebBrowser1.Busy 'wait until the page loads by looping
Application.DoEvents()
Loop
AxWebBrowser1.Document.forms(0).All("FromEMail").v alue = "xx*@yyy.com"
AxWebBrowser1.Document.forms(0).All("PostingTitle" ).value = "text text
text"
AxWebBrowser1.Document.forms(0).All("PostingBody") .value = "lets get
to business"
'AxWebBrowser1.Document.forms(0).All("previewForm" ).value = "yeah"
AxWebBrowser1.Document.forms(0).All("previewForm") .click()
Do While AxWebBrowser1.Busy 'wait until the page loads by looping
Application.DoEvents()
Loop
AxWebBrowser1.Document.forms(0).All("finishForm"). click()

End Sub

I guess it is a problem with that second DoEvents loop. I guess the
problem can be summarized thusly: how to handle the loading of the
page and click a submit button on a sequence of web pages.

Please advise.
Nov 22 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.