[PyQt] QtWebEngineView and QtTest on 5.8

Kevin Mcintyre kebin70 at gmail.com
Tue Feb 28 04:53:10 GMT 2017


Prior to 5.8 I was able to simulate a keyclick on QtWebEngineView:

--- 5.7.1 Output ---
5.7.1
finished
--- 5.8.0 Output ---
5.8.0
exception: PyQt5.QtCore.QAbstractAnimation represents a C++ abstract class
and cannot be instantiated
---

import sys

from PyQt5.QtWebEngineWidgets import QWebEngineView
from PyQt5.QtWidgets import QApplication
from PyQt5.QtCore import QUrl
from PyQt5 import QtCore

app = QApplication(sys.argv)
qev = QWebEngineView()
qev.show()

print QtCore.qVersion()

def runTest():
    try:
        from PyQt5.QtTest import QTest
        from PyQt5.QtCore import Qt
        QTest.keyClick(qev, Qt.Key_Tab)
        print 'finished'
    except Exception as e:
        print 'exception:', e
    finally:
        exit()

qev.page().loadFinished.connect(runTest)
qev.load(QUrl('http://google.com'))
app.exec_()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20170227/7646049d/attachment.html>


More information about the PyQt mailing list