के साथ मैं इंटरनेट एक्सप्लोरर 8 (विंडोज 7 पर पायथन 2.7 का उपयोग करके) स्वचालित करना चाहता हूं।त्रुटि "ऑब्जेक्ट का ऑब्जेक्ट अपने ग्राहकों से डिस्कनेक्ट हो गया है" - स्वचालित आईई 8 पाइथन और win32com
import sys, time
from win32com.client import WithEvents, Dispatch
import pythoncom
import threading
stopEvent=threading.Event()
class EventSink(object):
def OnNavigateComplete2(self,*args):
print "complete",args
stopEvent.set()
def waitUntilReady(ie):
if ie.ReadyState!=4:
while 1:
print "waiting"
pythoncom.PumpWaitingMessages()
stopEvent.wait(.2)
if stopEvent.isSet() or ie.ReadyState==4:
stopEvent.clear()
break;
if __name__ == '__main__':
time.clock()
ie=Dispatch('InternetExplorer.Application',EventSink)
ev=WithEvents(ie,EventSink)
ie.Visible=True
ie.AddressBar = True
ie.Navigate("http://www.sap.com/austria/index.epx")
waitUntilReady(ie)
मैं http://www.sap.com/austria/index.epx के लिए निम्न त्रुटि संदेश मिल गया:
waiting
waiting
Traceback (most recent call last):
File "C:\Users\w\My Documents\Aptana Studio 3 Workspace\MyApp\src\GoToIdeaWindow.py", line 41, in <module>
waitUntilReady(ie)
File "C:\Users\w\My Documents\Aptana Studio 3 Workspace\MyApp\src\GoToIdeaWindow.py", line 26, in waitUntilReady
if stopEvent.isSet() or ie.ReadyState==4:
File "C:\Python27\lib\site-packages\win32com\client\__init__.py", line 463, in __getattr__
return self._ApplyTypes_(*args)
File "C:\Python27\lib\site-packages\win32com\client\__init__.py", line 456, in _ApplyTypes_
self._oleobj_.InvokeTypes(dispid, 0, wFlags, retType, argTypes, *args),
pywintypes.com_error: (-2147417848, 'The object invoked has disconnected from its clients.', None, None)
कोड के लिए पूरी तरह से काम करता है, उदाहरण के लिए, google.com या bbc.com यहाँ a post found on SO के बाद मेरे कोड है। क्या कोई जानता है कि क्या कारण हो सकता है?
http://go-gaga-over-testing.blogspot.se/2013/06/the-object-invoked-has-disconnected.html –