2012-10-07 18 views
1

我不确定如何使用nativeClickAt()方法单击任意位置。在spynner模块中使用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) 

但是当我运行该脚本,我得到一个segfault错误

任何帮助将非常感激。

回答

2

我们已经讨论了这个非公开脚本的非名单。

我们所做的:

  • 你必须有一个UI发送原始点击事件:browser.show()
  • 当脚本执行,否则将在虚空中点击你不能隐藏窗口 - >段错误。
1

本地点击很大程度上取决于浏览器的状态以及在您触发事件时可能变得不可用的帧,从而导致段错误。

由于这取决于使用情况,最简单的方法是进行可重复性测试!

不过,我会检查该方法从2.0升级以来的行为是否正确。

也一定要有最新的spynner!

此外,为了在段错误发生时跟踪spynner错误,最好总是使用gdb或任何调试器。是的,我过去一直通过改变代码来解决segfaults问题。

+0

我们已经讨论了非公开脚本的列表。 – kiorky

相关问题