PyQt icon indicating copy to clipboard operation
PyQt copied to clipboard

[问题] 文件QWebEngineView.SiteDiffUser:reCaptcha 不能正常加载

Open ANXIETIER opened this issue 4 years ago • 1 comments

我在Window.init()中把加载网页那一行换成

self.webView2.load(QUrl('https://www.google.com/recaptcha/api2/demo'))

这是加载reCaptcha的demo网页,当我注释掉下面

        profile2 = QWebEngineProfile('storage2', self.webView2)
        profile2.setPersistentStoragePath('Tmp/Storage2')
        print(profile2.cookieStore())
        page2 = QWebEnginePage(profile2, self.webView2)
        self.webView2.setPage(page2)

以后,可以正常加载,但我想保留这部分,有解决方案吗

ANXIETIER avatar Dec 09 '20 04:12 ANXIETIER

你是想修改cookie的保存路径么。如果这样有问题。你可以不用修改。可以用过 persistentStoragePath 获取原来的cookie目录 https://doc.qt.io/qt-5/qwebengineprofile.html#persistentStoragePath

892768447 avatar Dec 10 '20 05:12 892768447

@ANXIETIER

测试发现问题出现在路径上。 设置为相对路径下 profile2.setPersistentStoragePath('Tmp/Storage2') 需要改为绝对路径

这样就可以了 profile2.setPersistentStoragePath(os.path.abspath('Tmp/Storage2'))

892768447 avatar Feb 02 '23 06:02 892768447