- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我想自动化 Internet Explorer 8(在 Windows 7 上使用 python 2.7)机器。这是我在 a post found on SO 之后的代码:
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。有谁知道可能是什么原因?
最佳答案
在 IE9 上,您需要降低安全设置才能使脚本运行:
IE9 -> Internet Options -> Security -> Trusted Sites : Low
IE9 -> Internet Options -> Security -> Internet : Medium + unchecked Enable Protected Mode
IE9 -> Internet Options -> Security -> Restricted Sites : unchecked Enable Protected Mode
关于python - 错误 "The object invoked has disconnected from its clients"- 使用 python 和 win32com 自动化 IE 8,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6661005/
我是 javascript 世界的新手。最近我在 nodejs 中开发一个聊天应用程序。所以我有一个叫gracefulshutdown的方法如下。 var gracefulShutdown = fun
如标题所示,我已经能够连接到 Google 游戏服务,在两台设备之间交换数据并且一切正常,除了一件事:断开连接回调 . 我试图拦截 onPeersDisconnected 和 onP2PDisconn
我在 ruby 1.9.3 中有这个: Net::SFTP.start(ENV['SFTP_HOST'], ENV['SFTP_USERNAME'], password: ENV['SFTP_PA
我目前正在设计一个应用程序,它需要连接到设备、写入/读取数据并可靠地关闭连接。目前,我有写/读实体。我的断开连接然后重新连接非常不可靠,实际上经常使手机崩溃,有时甚至使 Eclipse 崩溃。 连接功
我写了下面的代码: $dbh = DBI->connect('dbi:SQLite:mysqlite.db', "", "") || die "Cannot connect: $DBI::errstr
第一个 View Controller 隐藏了导航栏。第二个是带有大标题的可见导航栏。向前过渡很好。 ScrollView 的行为符合预期——导航栏在下拉时拉伸(stretch),在向上拉时收缩。但是
我写了一个 perl 模块: package sql; use strict; use XML::Simple; use DBI; use DBD::mysql; require Exporter;
我有一个处理图像的多线程 Cocoa 应用程序。该程序有一个进度条和一些文本,显示该过程的进度。这一切都很好。然而,有时界面会卡住并且所有内容都会停止更新。进度条停止移动,百分比计数器中的文本停止更新
使用浏览器客户端,如何在每次通话中设置sounds.disconnect()?有没有办法访问设备单例以修改该设置?我知道我在获得device.ready回调时可以访问,但是我想在每次调用时修改设置。
我很困惑:) 我将 SignalR 与 Asp.Net Core 和 JavaScript 客户端结合使用。我只想检测断开连接并自动重新连接。 经过多次谷歌搜索后,我想出了这个: connection
两台计算机通过套接字连接。如果服务器/客户端关闭连接从他们的末端(即关闭InputStream,OutputStream和Socket)那么我如何通知另一端关于断开连接?我知道有一种方法 - 尝试从
基本上在音乐结束后,我希望机器人与 channel 断开连接。这是我的: const leave = message => { return message.guild.voiceConnecti
我的代码发送 HttpConnection,然后尝试使用 connection.getInputStream() 或 connection.getErrorStream() 反序列化响应。 HttpU
我有一个网站,其中包含一些代码模块,如下所示。您可以从 Bootstrap 更改网格系统的大小。所以这就是为什么我的网格是第一行。使用我当前的代码,它看起来像这样: .label{ backgr
我试图让 Django 在一种情况下不发送信号。添加模型 Delivery 的新实例(在创建 Job 之后)作为模型 Job 的属性时,我不想发送信号,因为该信号应提醒管理员 Job 已被编辑。 不幸
我正在创建套接字服务器。但我不知道,我怎么知道客户端断开连接了?我正在 Windows 下创建服务器并使用 berkeley 套接字功能(读取、发送、连接....)。我最好想要一个跨平台解决方案(没有
我正在使用 this tutorial制作 Node/mongo 应用程序。当我运行 addContact 时,联系人似乎已保存到数据库中,但我收到一条错误消息,指出断开连接功能不是一个功能。谁能告诉
问题:在发出手动 .disconnect() 后如何将客户端重新连接到服务器? 在我当前的项目中,当用户从 session 中注销时,我需要断开客户端与服务器的连接。我执行了 socket.disco
以下代码基本上可以按预期工作。然而,偏执,我想,为了避免资源泄漏, HttpURLConnection.disconnect用完后需要调用吗? 我需要调用 InputStream.close 吗? 我
我不是在考虑排队信号在disconnect()之后仍然在接收线程中传递的问题,而是: 考虑这样一种情况,Sender 对象在线程 1 中生成信号,而线程 2 中有一个 Receiver 对象,它有一个
我是一名优秀的程序员,十分优秀!