[问题] 文件QWebEngineView.SiteDiffUser:reCaptcha 不能正常加载
ANXIETIER opened this issue · 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)
以后,可以正常加载,但我想保留这部分,有解决方案吗
你是想修改cookie的保存路径么。如果这样有问题。你可以不用修改。可以用过 persistentStoragePath 获取原来的cookie目录
https://doc.qt.io/qt-5/qwebengineprofile.html#persistentStoragePath
测试发现问题出现在路径上。
设置为相对路径下 profile2.setPersistentStoragePath('Tmp/Storage2')
需要改为绝对路径
这样就可以了
profile2.setPersistentStoragePath(os.path.abspath('Tmp/Storage2'))