from PyQt5.QtWebChannel import QWebChannel from PyQt5.QtWebEngineWidgets import QWebEngineView from PyQt5.QtCore import QUrl from interactive import JavascriptBridge class Browser(QWebEngineView): def __init__(self, *args, **kwargs): super(Browser, self).__init__(*args, **kwargs) self.pWebChannel = QWebChannel(self) self.js_bridge = JavascriptBridge(self) self.pWebChannel.registerObject("interactObj", self.js_bridge) self.page().setWebChannel(self.pWebChannel) # self.url = "https://wx5ec53535eb20a118.wx.qmgkj.cn/activity/dev/slider/#/record" self.url = "https://baidu.com" self.page().load(QUrl(self.url))