我不确定如何使用nativeClickAt()方法单击任意位置。

spynner class中,文档说:

"""Click on an arbitrar location of the browser.
@param where: where to click (QPoint)
@param real: if not true coordinates are relative to the window instead
    of the screen
@timeout seconds: seconds to wait after click"""


我已经搜索了QT doc来找出什么是QPoint对象。因此它似乎是x,y坐标。

到目前为止我尝试过的是:

import spynner
from PyQt4 import QtCore

browser = spynner.Browser(
    embed_jquery = True,
    debug_level = spynner.DEBUG
)

(...)

place = QtCore.QPoint(311,443)
print place # PyQt4.QtCore.QPoint(311, 443)
browser.nativeClickAt(place, 3, real=True)


但是,当我运行脚本时,出现了段错误。

任何帮助将不胜感激。

最佳答案

我们已经讨论了此非公开脚本的清单。

我们所做的:


您必须具有ui才能发送原始点击事件:browser.show()
脚本执行时不得隐藏窗口,否则它将单击void-> segfault。

10-06 08:41