Cefsharp RequestHandler can't catch all the incoming request

China☆狼群 提交于 2020-06-01 07:38:28

问题


I encountered a strange problem when using cefsharp. The browser accessed Twitter and automatically scrolled to the bottom to load new posts. There should be many requests, but the Function GetResourceRequestHandler didn't capture any requests, and the function wasn't called at all. Using the same class to capture Pinterest, requests can be captured, including XHR.

The link to visit Twitter is https://twitter.com/HanamuraAsuka You can see many XHR requests in chrome's develop tool, such as https://api.twitter.com/2/timeline/media/

I tried many times and the function was called for only a few times.

Thanks.

chrome.RequestHandler = New TwitterRequestHandler
Public Class TwitterRequestHandler

    Inherits RequestHandler

    Protected Overrides Function GetResourceRequestHandler(chromiumWebBrowser As IWebBrowser, browser As IBrowser, frame As IFrame, request As IRequest, isNavigation As Boolean, isDownload As Boolean, requestInitiator As String, ByRef disableDefaultHandling As Boolean) As IResourceRequestHandler

        If request.Url.Contains("/timeline/media/") Or request.Url.Contains("/timeline/profile/") Then
            Return New TwitterResourceRequestHandler
        End If
        Return Nothing
    End Function
End Class

来源:https://stackoverflow.com/questions/61577179/cefsharp-requesthandler-cant-catch-all-the-incoming-request

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!