Search code examples
pythonqtwebkitspynner

Segfault using nativeClickAt() method in spynner module


I'm not sure how to use nativeClickAt() method to click at an arbitrar location.

In the spynner class, the doc said :

"""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"""

I have had searched QT doc to figure out what is a QPoint object. So it seems to be x, y coordinates.

What I tried so far :

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)

But when I run the script, I get a segfault error.

Any help will be very appreciate.


Solution

  • We have discussed offlist of this non public script.

    What we have done:

    • You must have an ui to send raw click events : browser.show()
    • You must not hide the window when the script executes or it will click in the void -> segfault.