如何解决QWebEngineView 和智能卡
这个问题与this一个有关。问题是当一个网站加载到 QWebEngineView 中时,我将如何登录到需要智能卡的网站。
例如,来自链接问题的这个。因为它只是触发建立连接失败,因为当您单击登录按钮时没有将证书传递给它。
import sys
from PyQt5.QtCore import QUrl
from PyQt5.QtWidgets import QApplication
from PyQt5.QtWebEngineWidgets import QWebEnginePage,QWebEngineView
class WebEnginePage(QWebEnginePage):
def certificateError(self,error):
# If you want to ignore the certificates of certain pages
# then do something like
# if error.url() == QUrl("https://www.us.army.mil/"):
# error.ignoreCertificateError()
# return True
# return super().certificateError(error)
error.ignoreCertificateError()
return True
def main(args):
app = QApplication(args)
webview = QWebEngineView()
page = WebEnginePage()
webview.setPage(page)
webview.load(QUrl("https://www.us.army.mil/"))
webview.show()
sys.exit(app.exec_())
if __name__ == "__main__":
main(sys.argv)
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。