Friday 15 April 2011

vbscript - ie.document.body.innerhtml picking up wrong HTML -


When I use the innerHtml property, it appears that HTML Resulting is the production of forms that I am after HTML in the table, in which it is f_details ('277095'); where f_details ('num'); Each license represents a license number for each agent. This script navigates to the site, selects the county, submits the form, and dumps the HTML - just is not the right HTML. How can I target the HTML of the resulting table (visible after the table is presented Table)? Set objWshShell = wscript.CreateObject ("wscript.Shell") Set IE = CreateObject ("internetexplorer.application") set to fso = CreateObject ("Scripting.FileSystemObject") i = 1 for 3 '77 if i = 3 So IE.Visible = True IE.Navigate "https://lic.ok.gov/PublicPortal/OREC/FindAssociateEntity.jsp" exit IE.ReadyState = 4 up to: WScript.sleep 100: Loop IE. Make up the document. Reidset = "Full": WScript.sleep 100: Loop IE.Document.getElementsByTagName ("Select") ("AddrCountyCode"). Value = I IE.Document.ReadyState = "full": WScript.sleep 100: IE.Document.getElementsByTagName ("Input") for each BTN loop if BTN.name = "BTN search" then click BTN. Next stringstrings = ie document.oneerhiber filename = create object ("Scripting.FileSystemObject"). GetParentFolderName (WScript.ScriptFullName) & amp; Set "\ License.txt" set fso = createobject ("scripting.filesystemobject") set ts = fso.opentextfile (file name, 8, true) t. Written strTestString ts.close next

has been modified to dump only 2 pages to modify the code.

1) you

2) after you press the button The page must wait until it is loaded.

So to replace with each code loop:

  for each BT in IE.Document.getElementsByTagName ("Input") if btn Name = "btnSearch" then BTN. To exit end click Next to IE.Document.ReadyState = "full": WScript.sleep 100: Loop  

Side Notes:

You do not have to set up your form as FileSystemObject as your i loop again as FSO, since you did it earlier before loop.

To set FileName you do not have to create another object because you have already created FileSystemObject , so by First set the name of the file loop in this way:

  filename = FSO.GetParentFolderName (WScript.ScriptFullName) & amp; "\ License.txt"  

Hope this helps.


No comments:

Post a Comment