Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Gathering Info from Web Pages
Message
De
15/11/2010 13:27:34
 
 
À
15/11/2010 13:04:53
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 9 SP2
Divers
Thread ID:
01489134
Message ID:
01489150
Vues:
57
I do a lot of IE automation myself, and I have found IE WebDeveloper to be a fantastic help. http://www.ieinspector.com/dominspector/

With IE WebDeveloper active, you can find the complete "path" to any element by clicking on them. For instance you will get this "path" to the "Subscribe" button on the URL I showed you: document.forms.item(0).childNodes.item(4).childNodes.item(3). To the "Your Email Here" textbox, you get document.forms.item(0).email. With this info I can make this little program, which I promise you actually works:
lcURL='http://www.ieinspector.com/dominspector/'
lcEmail='myemail@mysite.it'
lnTime=1200 && 12 seconds
Public lox
lox=Createobject('internetexplorer.application')
lox.visible=.T.
lox.Navigate(lcURL)
If !NavComplete(lox,lnTime)
   ??Chr(7)
   Wait 'Timeout feil!' Window
   lox.Visible=.F.
   Release lox
   Return
Endif
lox.document.forms.item(0).email.innertext=lcEmail
*lox.document.forms.item(0).childNodes.item(4).childNodes.item(3).click() && Commented out for obvious reasons....

   
Function NavComplete
   Lpara toIE, tnTimeout
   lnTimeout=Iif( Type("tnTimeout")="N",tnTimeout ,60 )
   lnTimeElapsed=0
   lnStartSeconds=Seconds()
   Do While .T.
      If toIE.ReadyState=4 And !toIE.Busy
         Do While .T.
            If toIE.Document.ReadyState="complete"
               Return .T.
            Endif
            If (Seconds()-lnStartSeconds)>lnTimeout
               Return .F.
            Endif
         Enddo
      Endif
      If (Seconds()-lnStartSeconds)>lnTimeout
         Return .F.
      Endif
   Enddo
Endfunc
>Really interesting Tore thanks, I don't know if it will solve my problem but it's great anyway.
>
>
>>Check out http://www.west-wind.com/presentations/shellapi/shellapi.asp
>>
>>>Hi there,
>>>I Have the need of gathering info from a web page.
>>>I remember it was possible to gather the Html code from the web but I'd would be glad if someone recalled me how :)
>>>What I don't really know how to do is programmatically clicking on a link and to get the html code of the opened page.
>>>
>>>Thanks
>>>Alessio
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform