WebEnginePage
-
Hi!
I can't load web page. I get this error:Release of profile requested but WebEnginePage still not deleted. Expect troubles !
This my code:
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 return error.isOverridable() 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)
-
it seems like you should move
app = QApplication(args)
to main -
This helped to fix the error. But on some computers, the web page opens, and on some it doesn't. What could be the problem?
hi
for me the shown URL
"https://www.us.army.mil/"goes to http://www.us.army.mil/
and my browser doesn't like it as it uses the insecure address.
It could be something like that.
-
I use a different local url, which requires confirmation when opened in the browser. On different computers, this url opens in the browser, but it doesn't open everywhere in my program. There are no errors. What could be the problem?
- There are no errors. What could be the problem?
Hi
so you checked
https://doc.qt.io/qt-5/qwebengineview.html#loadFinished
it it says ok ?
- There are no errors. What could be the problem?
-
- There are no errors. What could be the problem?
Hi
so you checked
https://doc.qt.io/qt-5/qwebengineview.html#loadFinished
it it says ok ?
- There are no errors. What could be the problem?
-
- There are no errors. What could be the problem?
Hi
so you checked
https://doc.qt.io/qt-5/qwebengineview.html#loadFinished
it it says ok ?
- There are no errors. What could be the problem?
-
Hi
I didnt find anything like errorString or similar.On the same pc here app dont work. the same URL can be open in a browser ?
-
@Mikeeeeee
Apparently not, other then theok
being returned as false. There does not seem to be any "error" information.which requires confirmation when opened in the browser
What does this mean?
-
- There are no errors. What could be the problem?
Hi
so you checked
https://doc.qt.io/qt-5/qwebengineview.html#loadFinished
it it says ok ?
- There are no errors. What could be the problem?
-
@Mikeeeeee
Apparently not, other then theok
being returned as false. There does not seem to be any "error" information.which requires confirmation when opened in the browser
What does this mean?
-
@JonB I can't just open the page in the browser the browser says that the connection is not secure and requires me to confirm that I have gone to the desired web page
@Mikeeeeee
So presumably that is why it does not load in aQWebEnginePage
. And if it works on one computer and not on another there must be a difference in this area.Does your
certificateError()
method get hit? If so, what doeserror.isOverridable()
return?You have not said, but I presume this too is an
https
address?Do both machines have the OpenSSL installed correctly, which I understand Qt needs?
What about trying a
QNetworkRequest
against it instead ofQWebEnginePage
, does that give more information? -
@Mikeeeeee
So presumably that is why it does not load in aQWebEnginePage
. And if it works on one computer and not on another there must be a difference in this area.Does your
certificateError()
method get hit? If so, what doeserror.isOverridable()
return?You have not said, but I presume this too is an
https
address?Do both machines have the OpenSSL installed correctly, which I understand Qt needs?
What about trying a
QNetworkRequest
against it instead ofQWebEnginePage
, does that give more information? -
@JonB That's right, an https request. I use the same conda environment. I transfer it to other computers. The program uses REST API https requests, so it's probably not OpenSSL. What else could it be?
@Mikeeeeee
I don't know, but I wouldn't think a conda environment would be at issue. It's not my area, but if indeed Qt needs OpenSSL libraries I would have more suspected that area.Like I said, maybe trying a
QNetworkRequest
would reveal more information? -
@JonB said in WebEnginePage:
QNetworkRequest
I just rechecked OpenSSL, it's the right version. This web page does not have a RestAPI. How can QNetworkRequest help me?
@Mikeeeeee
I just thought it would give you more access to see what is going. Ability to look at headers, control redirects, catch SSL errors, that sort of thing. But I'm not an expert. -
If I do get request then I get this error:
C:\tempPythonProject\Miniconda3\lib\site-packages\urllib3\connectionpool.py:1013: InsecureRequestWarning: Unverified HTTPS request is being made to host '10.0.102.112'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings warnings.warn(