From: Janet Heath on
Everyday, sometimes several times a day, I get on a website, login and
check for parttime jobs to accept. Would like to automate this
process so that I don't have to be on the system so much. I have
experience programming in VB .NET but nothing like this. Can this be
done? If so, any ideas?


Janet
From: Captain Jack on
"Janet Heath" <janetcatherine.heath(a)gmail.com> wrote in message
news:3fca063c-610e-4bbf-a0bb-e7f74be526c4(a)o9g2000prg.googlegroups.com...
> Everyday, sometimes several times a day, I get on a website, login and
> check for parttime jobs to accept. Would like to automate this
> process so that I don't have to be on the system so much. I have
> experience programming in VB .NET but nothing like this. Can this be
> done? If so, any ideas?
>
>
> Janet

I do something like that with the WebBrowser control (in
System.Windows.Forms). First, I go to the web site (with Internet Explorer,
in my case) and look at the HTML code to find the name tags for the input
controls on the web form. Then, I write the program to navigate to the web
site that has the form, then loop through the HTML elements in the
Document.All property of the browser. When I find an element with the
TagName property is "INPUT", I check the Id property for the input field
names, then set the InnerText property to the value that I want to input.
After I have all the input fields set, I loop through the elements to find
one with the TagName of "FORM", then I call the element's InvokeMember
method with an argument of "Submit".

Once the following page loads, I read through the HTML of the document in
the WebBrowser and scrape out the data that I want to use.

There's some reasonably useful sample code at the MSDN library under the
WebBrowser control that might be helpful, too.

--
Jack


From: Janet Heath on
On Nov 3, 10:56 am, "Captain Jack" <CaptainJack1...(a)comcast.net>
wrote:
> "Janet Heath" <janetcatherine.he...(a)gmail.com> wrote in message
>
> news:3fca063c-610e-4bbf-a0bb-e7f74be526c4(a)o9g2000prg.googlegroups.com...
>
> > Everyday, sometimes several times a day, I get on a website, login and
> > check for parttime jobs to accept.  Would like to automate this
> > process so that I don't have to be on the system so much.  I have
> > experience programming in VB .NET but nothing like this.  Can this be
> > done?  If so, any ideas?
>
> > Janet
>
> I do something like that with the WebBrowser control (in
> System.Windows.Forms). First, I go to the web site (with Internet Explorer,
> in my case) and look at the HTML code to find the name tags for the input
> controls on the web form. Then, I write the program to navigate to the web
> site that has the form, then loop through the HTML elements in the
> Document.All property of the browser. When I find an element with the
> TagName property is "INPUT", I check the Id property for the input field
> names, then set the InnerText property to the value that I want to input.
> After I have all the input fields set, I loop through the elements to find
> one with the TagName of "FORM", then I call the element's InvokeMember
> method with an argument of "Submit".
>
> Once the following page loads, I read through the HTML of the document in
> the WebBrowser and scrape out the data that I want to use.
>
> There's some reasonably useful sample code at the MSDN library under the
> WebBrowser control that might be helpful, too.
>
> --
> Jack

Thank you so much Jack for your info. The form is in an .asp program.


Janet
From: Captain Jack on
"Janet Heath" <janetcatherine.heath(a)gmail.com> wrote in message
news:2e1e0c0b-51cb-416b-8389-89167ecb59ed(a)t11g2000prh.googlegroups.com...
On Nov 3, 10:56 am, "Captain Jack" <CaptainJack1...(a)comcast.net>
wrote:
> Thank you so much Jack for your info. The form is in an .asp program.
>
>
> Janet

You're quite welcome. The ASP will send HTML to the browser control, so that
by itself isn't a problem. However, you may get multiple pages in the
DocumentCompleted event of the browser control, because ASP servers often
send intermediate pages to a web clilent. Most browsers don't show the
intermediate URL's so you don't normally see them. Make sure you scane the
document for what you're looking for, and if the forms aren't there, wait
for another DocumentCompleted event.



From: Captain Jack on
"Janet Heath" <janetcatherine.heath(a)gmail.com> wrote in message
news:6cb4f953-f13f-457a-a714-d3fee28ce6ae(a)13g2000prl.googlegroups.com...
> Ok.
>
> Here is the code that I get when I do view source on the Login Page:

There are two things you're looking for in that document. One is any item
with the "input" HTML tag, which are your input boxes, and the "form" HTML
tag, which is the element that you'll do the submit on. I searched with a
text editor, and found these two input tags that were pertinent:

<input name="LastName" type="text" id="LastName" class="LoginTextBox"
maxlength="50" />
<input name="PinNumber" type="password" id="PinNumber" class="LoginTextBox"
maxlength="9" />

There were some others, but these are the two that we want, which can be
told from the names as well as the nearby text that appears on the displayed
web page as labels. The form element itself is this:

<form name="frmLogin" method=post action="../login/loginpage.asp"
onSubmit="return CheckPassWord(frmLogin.PinNumber.value, null)" ID="Form2">

Once you've established that your document has properly loaded into the web
browser control (checking the URL during the DocumentCompleted event is what
I do), then this code would be one way to do what you want:

For Each Element As HtmlElement In wbrMain.Document.All
If Element.TagName.ToUpper = "INPUT" Then
Select Case Element.Id
Case "LastName"
Element.InnerText = "Name To Fill In"
Case "PinNumber"
Element.InnerText = "Password To Fill In"
End Select
End If
Next
For Each Element As HtmlElement In wbrMain.Document.All
If Element.TagName.ToUpper = "FORM" Then
Element.InvokeMember("Submit")
Exit For
End If
Next

Once the submit function of the form is performed, the web browser control
should load with the next page sent from the server. When you get another
DocumentCompleted event, you can scan through it's elements to get the info
you want to report on, proceed to the next page, or whatever.

--
Jack