Thanks all for the inputs!
'
I have made a lot of progress in that I can login and create a cursor
listing the elements in the document but I am still stumbling around trying
to get a grip on how to talk to the DOM.  John's post shows that the same
information can be accessed in more than one way.  This is very helpful but
I need to understand how it works.  My goal at this point is to have my
code show all the user entry fields, buttons, dropdowns, etc.

I found this online:

Icious <http://www.tek-tips.com/userinfo.cfm?member=Icious> (Programmer)

 31 Oct 01 9:17

"You can automate IE to complete that task.  I have written code that does
exactly that.  The only problem I ran into is how to reference specific
objects on the webpage.  I ended up running the code with the debugger and
tried adding objects to the watch window and seeing which values I got
back.  By manipulating the oie.DOCUMENT.SCRIPT.WINDOW.DOCUMENT.all.item(x)
references, I was able to locate the exact object I needed to get where x
is an index number of said object."


This indicates that what I want to do is possible but the references he
refers to only confuse me at this point.

When I get to the next phase I plan to start another thread showing my code
at that point.

Thanks again - Joe

On Mon, Feb 10, 2014 at 10:58 AM, John Harvey <john.har...@shelbynet.com>wrote:

> Here is how to populate the text boxes:
>
> loie.Document.body.all('Username').value='ThisIsMyUserName'
> loie.Document.body.all('Password').value='MyPassword'
>
> Using the forms object:
>
> loie.Document.forms.form1.username.value='ThisHereBeMe'
> loie.Document.forms.form1.Password.value='IcannotDivulgeMyPassword'
>
> John
>
> -----Original Message-----
> From: ProFox [mailto:profox-boun...@leafe.com] On Behalf Of Joe Yoder
> Sent: Friday, February 07, 2014 8:47 AM
> To: Foxpro forum
> Subject: Re: Automated bank/credit card transaction
>
> I have virtually no experience with HTML.  Looking at the VFP code it
> attempts to identify the names of all the forms.  I assume this is what one
> would do to find the fields that can accept data.  Looking at the site
> source, the WWW.UniversalThread.com site does not appears to have any
> forms.
> This could account for the error message but it may be that "FORMS"
> are inherent in any HTML document and the term does not necessarily show up
> in the source.
>
> Can someone enlighten me?
>
> Thanks - Joe
>
>
> On Fri, Feb 7, 2014 at 8:03 AM, Stephen Russell
> <srussell...@gmail.com>wrote:
>
> > Just a guess but you are in a javascript applet instead of the plain
> > old html window.
> >
> >
> > On Fri, Feb 7, 2014 at 12:18 AM, Joe Yoder <j...@wheypower.com> wrote:
> >
> > > Thanks guys for the input so far!  I found some very basic sample
> > > code
> > but
> > > haven't succeeded in logging in.  The execution fails on the line
> > > that attempts to set the username.  I suspect that the HTML or the
> > > site has changed since the code was written but I haven't figured
> > > out how to get around it.  Here is the code if anyone cares to try
> > > it and tell me what needs to change:
> > >
> > > #define CR CHR(13)
> > >
> > > LOCAL ;
> > > loIE as InternetExplorer.Application, ; llSuccess as Logical, ; x as
> > > String
> > >
> > > * Create an instance of IE
> > > loIE = CREATEOBJECT("InternetExplorer.Application")
> > > loIE.Visible = .T.
> > >
> > > * Tell IE to load a page
> > > llSuccess = loIE.Navigate("http://www.universalthread.com";)
> > >
> > > * Wait for IE to do it
> > > llSuccess = lWait( loIE )
> > >
> > > * Show the names of the forms:
> > > x = "Forms:"
> > > For lnForm = 0 to loIE.Document.forms.length - 1
> > >   x = x + TRANSFORM(lnForm) + ": " +
> > > TRANSFORM(loIE.Document.forms(lnForm).name)
> > > EndFor
> > > x = x + CR
> > > ? x
> > >
> > > * Fill in one of the forms
> > > loIE.Document.Forms.form1("login").Username.Value = "foo"  && Fails
> > > with "Member FORM1 does not evaluate to an object"
> > > loIE.Document.Forms("login").Password.Value = "poo"
> > > loIE.Document.Forms(0).Submit()
> > > llSuccess = lWait( loIE )
> > >
> > > * Look at all of the objects.
> > > * all(0) represents everything,
> > > * 1-N are contained objects some of which are containers themselves,
> > > * so the same thing may apear in different .all(x)'s x = x + "All
> > > Objects:"
> > > For lnObj = 0 to loIE.Document.all.length - 1 loObj =
> > > loIE.Document.all( lnObj ) x = x + TRANSFORM(lnObj) + ": " +
> > > TRANSFORM(Substr(loObj.innerhtml, 1,
> > 20))
> > > x = x + TRANSFORM(loObj.TagName) + ": " + TRANSFORM(loObj.innertext)
> > > EndFor
> > >
> > > * Close IE.
> > > * You can leave it open, doesn't seem to be a problem,
> > > * unless .visible=.f. then it is harder to close cuz you cant see the
> X.
> > > loie.Quit
> > >
> > > * save and display results
> > > STRTOFILE(x, "WebResult.txt")
> > > MODIFY FILE WebResult.txt NOWAIT
> > > Return
> > >
> > >
> > >
> > > ******************************
> > > Function lWait( toIE )
> > > * Wait for IE to process what you told it too.
> > > * There has got to be a simpler way to do this.
> > >
> > > DECLARE Sleep IN Win32API INTEGER nMilliseconds
> > >
> > > Local ;
> > > ltStartTime, ;
> > > ltTimeOut, ;
> > > lcCheckThis, ;
> > > llRet
> > >
> > > ltStartTime = Datetime()
> > > ltTimeOut = ltStartTime + 60
> > >
> > > DO WHILE (Datetime() < ltTimeOut ) ; AND type( "toIE.document" ) <>
> > > "O"
> > > =Sleep(1000)
> > > EndDo
> > > DO WHILE (Datetime() < ltTimeOut ) ; AND toIE.busy
> > > =Sleep(1000)
> > > ENDDO
> > > DO WHILE (Datetime() < ltTimeOut ) ; and type(
> > > "toie.document.readystate" ) <> "C"
> > > =Sleep(1000)
> > > ENDDO
> > > DO WHILE (Datetime() < ltTimeOut ) ; and toie.document.readystate <>
> > > "complete"
> > > =Sleep(1000)
> > > ENDDO
> > >
> > > llRet = Datetime() < ltTimeOut
> > > If !llREt
> > > toie.Stop()
> > > EndIf
> > >
> > > RETURN llRet
> > >
> > >
> > >
> > > On Thu, Feb 6, 2014 at 11:57 PM, AndyHC <a...@hawthorncottage.com>
> > wrote:
> > >
> > > > .. or search Ed's archives for 'screen scraping' or 'xmlhttp'
> > > >
> > > >
> > > > On 07/02/2014 03:07, Alan Bourke wrote:
> > > >
> > > >>
> > > >> On Thu, Feb 6, 2014, at 07:46 PM, Joe Yoder wrote:
> > > >>
> > > >>  Any pointers on how to proceed will be welcome.
> > > >>>
> > > >>>  Check if they publish an API. If not, Google 'web scraping'.
> > > >>
[excessive quoting removed by server]

_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/CABQeDnWHgozPBOMdNou=6dc8le0n29w_ad0-puj321qvghj...@mail.gmail.com
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to