Issue
When I run everything works fine except it stops at instagram splash/loading screen, even the right click menu option don't work. Works for PyQt5 but not from PyQt6.There is no problem with internet connection.
from PyQt6.QtWidgets import *
from PyQt6.QtWebEngineWidgets import QWebEngineView
from PyQt6.QtWebEngineCore import QWebEnginePage, QWebEngineProfile
from PyQt6.QtCore import QUrl
class Main(QWebEngineView):
def __init__(self):
super().__init__()
self.profile = QWebEngineProfile("data", self) # Create a off-road profile with parent self
self.profile.setPersistentCookiesPolicy
(QWebEngineProfile.PersistentCookiesPolicy.AllowPersistentCookies) # Force the cookie to be stored in disk
self.profile.setHttpCacheType(QWebEngineProfile.HttpCacheType.DiskHttpCache) # Cache is stored in disk
self.profile.setPersistentStoragePath('data') # Cookie path in data folder in root
self.profile.setCachePath('data') # Cache path in data folder in root
self.page = QWebEnginePage(self.profile) # Create a page with profile from above
self.setPage(self.page) # not set page to QWebEngineView
self.load(QUrl("https://www.instagram.com")) # load the url in view
self.show()
app = QApplication(sys.argv)
main = Main()
app.exec()
I tried opening google I guess only sign in button worked. In PyQt5 everything work except a little bit JS. I expect the site to get load and it take input.
Solution
This seems like a bug of QtWebEngine.(What about reporting this on here?) You can remedy the problem by using absolute paths like this.
import os
...
class Main(QWebEngineView):
def __init__(self):
...
self.profile.setPersistentStoragePath(os.path.abspath('data'))
self.profile.setCachePath(os.path.abspath('data'))
...
Answered By - relent95
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.