selenium C# 等待后台请求(不是由 C# 代码发起)
我使用 selenium chrome 驱动程序与 cefsharp 结合使用,每次单击元素时,我正在处理的页面都会发送某种 ping 请求(fetch/xhr),问题是这些请求不是由 selenium chrome 驱动程序发起的,因此没有办法我跟踪他们并等待完成。 selenium 或 js 有什么方法可以跟踪这些请求吗?
Im using selenium chrome driver combined with cefsharp, the page im working on sends some kind of ping request(fetch/xhr) everytime an element is clicked the problem is that those request aren't initiated by selenium chrome driver so there is no wayy for me to track them and wait for the finish. Is there any way for selenium or js to track those requests?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用 Selenium 4,您实际上可以 拦截请求
调用
Enable
开始请求跟踪调用
WaitForRequestResponse
等待特定请求如果您可以处理相同的请求,您可以使用
Clear
清除已经捕获的请求上面的代码是尚未准备好立即使用,但应该对该方法有一个总体了解。
With Selenium 4 you actually can intercept requests
Call
Enable
to start requests trackingCall
WaitForRequestResponse
to wait for the specific requestIf you can same requests you can clean already catch requests with
Clear
The code above is not ready to be used right away but should give a general understanding of the approach.