I know Olaf has already advised a way to pull http-only cookies in #440 like below
However, some modern websites (cannot share link) are using different ways to set secure cookies. Hence, they're not accessible the way Olaf recommended in #440. So I tried by directly accessing browser's cookies using following code:Code:Private WithEvents WV As cWebView2 Private Sub Form_Load() Set WV = New_c.WebView2(hWnd, 0) End Sub Private Sub WV_InitComplete() WV.Navigate "http://SomeDomain.com", 0 End Sub Private Sub WV_DocumentComplete() Debug.Print WV.jsProp("document.cookie") End Sub Private Sub WV_WebResourceResponseReceived(ByVal ReqURI As String, ByVal ReqMethod As String, ByVal RespStatus As Long, ByVal RespReasonPhrase As String, ByVal RespHeaders As RC6.cCollection) If RespHeaders.Exists("Set-Cookie") Then Debug.Print RespHeaders("Set-Cookie") ' Dim i As Long 'alternatively, one can enumerate all response-headers on the JSON-Collection ' For i = 0 To RespHeaders.Count - 1 ' Debug.Print RespHeaders.KeyByIndex(i), RespHeaders.ItemByIndex(i) ' Next End Sub Private Sub Form_Resize() If Not WV Is Nothing Then WV.SyncSizeToHostWindow End Sub
Problem is that CallDevToolsProtocolMethod does not return anything. So just cannot receive response which I need. So, is there a workaround I could receive response from CallDevToolsProtocolMethod method or an alternate but solid way to pull all the cookies (including http-only ones).Code:WV.CallDevToolsProtocolMethod "Network.getAllCookies", "{}"
Thankyou so much!




Reply With Quote