如何使用 capybara-webkit 获取响应标头和时间
如何使用 capybara-webkit 获取网页中单独 ajax 请求的响应?
是否有任何特定方法可以捕获每个请求的响应时间?
笔记: 我正在将水豚与 rspec 一起使用。
例如:我在一个网页中有 3 个 Ajax 请求。我需要获取每个请求的单独响应时间和整个网页的响应时间。
谢谢, 普里亚
How to get response of seperate ajax requests in a web page using capybara-webkit?
Is there any particular method available to capture response time of each request?
Note:
Am using capybara with rspec.
For eg: i have 3 Ajax requests in a web page. I need to get separate response time of each request and the response time of entire web page.
Thanks,
Priya
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
一般来说这是不可能的,因为网络服务器在不同的进程中运行,但您可以创建一个自定义机架中间件并将所有响应转储到单独的日志文件。首先,您可以实现此处描述的技术:https://gist.github.com/2975611转储标头您可以使用 http://rack.rubyforge.org/doc/Rack/ContentLength.html
Generally it's not possible since webserver is running in the different process but you could create a custom rack middle-ware and dump all responses to the separate log file. For the beginning you could implement technique described here: https://gist.github.com/2975611 and for dumping headers you could use some code snippets from http://rack.rubyforge.org/doc/Rack/ContentLength.html