Version 2 of IE automation with tcom

Updated 2012-03-22 04:38:27 by Jorge

JM 13Feb2012 - I can fill a search box in a demo page,but I dont think having a fixed wait is how it should work, could you please advise

 console show
 puts start...
 package require tcom

 set ie [tcom::ref createobject InternetExplorer.Application]

 $ie Visible True
 #$ie Navigate "http://wiki.tcl.tk/_/search"
 $ie Navigate "http://www.sphider.eu/forum/read.php?2,6529,6529"
 while {[$ie Busy]} {
   puts [clock format [clock seconds]]
   update
 }
 after 10000

 set docObj [$ie Document]
 set objCollection [$docObj getElementById "search"]
 $objCollection innerText "Jorge"

JM 13Feb2012 - Answering to myself...this how it works:

 console show
 update
 #puts start...
 package require tcom

 set ie [tcom::ref createobject InternetExplorer.Application]

 $ie Visible True
 #$ie Navigate "http://wiki.tcl.tk/_/search"
 $ie Navigate "http://www.sphider.eu/forum/read.php?2,6529,6529"
 while {[$ie Busy]} {
   puts -nonewline .
   update
   after 100
 }
 #after 10000
 puts [[$ie Document] readyState]
  while {[[$ie Document] readyState] != "complete"} {
   puts [clock format [clock seconds]]
   update
   after 1000
 }

 set docObj [$ie Document]
 set objCollection [$docObj getElementById "search"]
 $objCollection innerText "Jorge"

And this is what the console shows when the page loading is kind of slow:

 ........loading
 Thu Feb 16 11:01:01 AM Mexico Standard Time 2012
 Thu Feb 16 11:01:02 AM Mexico Standard Time 2012
 Thu Feb 16 11:01:03 AM Mexico Standard Time 2012
 Thu Feb 16 11:01:04 AM Mexico Standard Time 2012
 Thu Feb 16 11:01:05 AM Mexico Standard Time 2012
 Thu Feb 16 11:01:06 AM Mexico Standard Time 2012
 Thu Feb 16 11:01:07 AM Mexico Standard Time 2012
 Thu Feb 16 11:01:08 AM Mexico Standard Time 2012

see also IE RC
Advanced Browser management