I have posted an example in my forum that explains step by step how to do it, It also clicks the submit button to perform the search.
http://www.jose.it-berater.org/smffo...p?topic=2824.0
Announcement
Collapse
No announcement yet.
Internet Explorer Automation
Collapse
X
-
If you're willing to use my new include files
http://www.jose.it-berater.org/smffo...p?topic=2819.0
instead of the ones provided with the compiler, this is what you will need:
Code:#COMPILE EXE #DIM ALL #INCLUDE "exdisp.inc" %USEHTMLWRAPPERS = 1 #INCLUDE "mshtml.inc" FUNCTION PBMAIN () AS LONG LOCAL ie AS IWebBrowser2 LOCAL pDoc AS IHTMLDocument2 ie = NEWCOM "InternetExplorer.Application" IF ISNOTHING(ie) THEN EXIT FUNCTION ie.Visible = 1 ie.Navigate UCODE$("http://www.google.com/") WHILE (ie.ReadyState <> 4) apiSleep 3 WEND pDoc = ie.Document IF ISOBJECT(pDoc) THEN IHTMLDocument_setElementValueById(pDoc, "q", "test") END IF END FUNCTION
Leave a comment:
-
Hmmm...
Included the MSHTML but now compiler is complaining about an undefined type Tag__userBITMAP do you know where that definition is located.
Leave a comment:
-
However I didn't see anything that would allow me to directly access the DOM.
Leave a comment:
-
Looking through sample files...
I found the Web Browser sample file that comes with PB and have been studying it. I looked through the WebBrowser.inc file and I saw the methods like Navigate, etc. However I didn't see anything that would allow me to directly access the DOM.
Does anyone know if there's a modified inc file with those extra methods built in to do something similar to the python code? Or any help on what I might be able to do to recreate that functionality.
So far I was thinking I could try programming my own method that parses the document and retrieves or sets values but I'm assuming creating a parser that can handle all the nuances of imperfect html code would be kind of hard.
Leave a comment:
-
Internet Explorer Automation
I've been looking around the forums but haven't come across a way of easily interfacing with internet explorer and accessing the DOM. Below is an example that works in Python.
Code:from win32com.client import Dispatch import time ie = Dispatch("InternetExplorer.Application") ie.Visible = 1 # Navigate to google ie.Navigate("http://www.google.com/") while (ie.ReadyState != 4): time.sleep(3) ie.Document.getElementById("q").Value = "test"
Tags: None
Leave a comment: