[PyQt] QtWebEngineView and QtTest on 5.8
Phil Thompson
phil at riverbankcomputing.com
Wed Mar 1 18:31:09 GMT 2017
On 28 Feb 2017, at 4:53 am, Kevin Mcintyre <kebin70 at gmail.com> wrote:
>
> 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_()
Works fine for me.
Phil
More information about the PyQt
mailing list