有办法使CefSharp的cookie访问者同步吗?
例如,当做
Private Sub btn1_Click_1(sender As Object, e As EventArgs) Handles btn1.Click
Dim CookieGrabber = New Cefsharp_CookieVisitor 'Implementation of ICookieVisitor
CefSharp.Cef.GetGlobalCookieManager().VisitUrlCookies(BaseURL, True, CookieGrabber)
Dim test = CookieGrabber
End Sub我在测试变量中得到了空的结果。它确实被设定了,但仅仅是在2秒之后。所以一切都正常,但时机不对,所以我想让它同步,或者等待完成。
我试过一些东西,但都没用。例如,How to gather all cookies using CEFSharp?,即使应该调用完成,ui也会被冻结。
发布于 2019-08-27 23:46:26
打电话给AsyncExtensions.VisitUrlCookiesAsync(CookieManager,BaseURL,True).Result达到了目的,所以我要结束这个问题。
https://stackoverflow.com/questions/57615754
复制相似问题