• <legend id='4ZvSc'><style id='4ZvSc'><dir id='4ZvSc'><q id='4ZvSc'></q></dir></style></legend>

      <bdo id='4ZvSc'></bdo><ul id='4ZvSc'></ul>

  • <tfoot id='4ZvSc'></tfoot>

        <i id='4ZvSc'><tr id='4ZvSc'><dt id='4ZvSc'><q id='4ZvSc'><span id='4ZvSc'><b id='4ZvSc'><form id='4ZvSc'><ins id='4ZvSc'></ins><ul id='4ZvSc'></ul><sub id='4ZvSc'></sub></form><legend id='4ZvSc'></legend><bdo id='4ZvSc'><pre id='4ZvSc'><center id='4ZvSc'></center></pre></bdo></b><th id='4ZvSc'></th></span></q></dt></tr></i><div id='4ZvSc'><tfoot id='4ZvSc'></tfoot><dl id='4ZvSc'><fieldset id='4ZvSc'></fieldset></dl></div>
      1. <small id='4ZvSc'></small><noframes id='4ZvSc'>

      2. 获取 chrome 性能和跟踪日志

        时间:2023-10-08

        <small id='KsVNa'></small><noframes id='KsVNa'>

          <tfoot id='KsVNa'></tfoot>
          <i id='KsVNa'><tr id='KsVNa'><dt id='KsVNa'><q id='KsVNa'><span id='KsVNa'><b id='KsVNa'><form id='KsVNa'><ins id='KsVNa'></ins><ul id='KsVNa'></ul><sub id='KsVNa'></sub></form><legend id='KsVNa'></legend><bdo id='KsVNa'><pre id='KsVNa'><center id='KsVNa'></center></pre></bdo></b><th id='KsVNa'></th></span></q></dt></tr></i><div id='KsVNa'><tfoot id='KsVNa'></tfoot><dl id='KsVNa'><fieldset id='KsVNa'></fieldset></dl></div>

              <bdo id='KsVNa'></bdo><ul id='KsVNa'></ul>
                  <tbody id='KsVNa'></tbody>
              1. <legend id='KsVNa'><style id='KsVNa'><dir id='KsVNa'><q id='KsVNa'></q></dir></style></legend>

                1. 本文介绍了获取 chrome 性能和跟踪日志的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我正在尝试遵循 使用 WebDriver 进行 Web 性能测试 google 测试自动化会议演讲中建议的想法和 ChromeDriver 性能日志"文档页面来获取我想要的跟踪数据提交到 webpagetest 以便稍后进行性能分析.

                  I'm trying to follow the idea suggested in the Web Performance Testing with WebDriver google test automation conference talk and ChromeDriver "Performance Log" documentation page to get the trace data which I want to submit to webpagetest for performance analysis later.

                  如何使用 python selenium 绑定 检索性能日志?

                  How can I retrieve performance logs using python selenium bindings?

                  我已尝试打印出驱动程序实例中可用的 log_types

                  I've tried to print out log_types available in the driver instance

                  from selenium import webdriver
                  
                  driver = webdriver.Chrome()
                  driver.get('https://stackoverflow.com')
                  
                  print driver.log_types
                  
                  driver.close()
                  

                  但只有

                  [u'browser', u'driver']
                  

                  我没有看到相关的命令行开关.

                  推荐答案

                  性能日志默认禁用.

                  要启用它,请使用 DesiredCapabilities 并配置loggingPrefs:

                  from selenium import webdriver
                  from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
                  
                  caps = DesiredCapabilities.CHROME
                   #as per latest docs
                  caps['goog:loggingPrefs'] = {'performance': 'ALL'}
                  driver = webdriver.Chrome(desired_capabilities=caps)
                  
                  driver.get('https://stackoverflow.com')
                  
                  for entry in driver.get_log('performance'):
                      print(entry)
                  
                  driver.quit()
                  

                  这会导致控制台上打印出一堆跟踪日志条目:

                  This results into a bunch of tracing log entries printed on the console:

                  {u'timestamp': 1419487459178, u'message': u'{"message":{"method":"Network.responseReceived","params":{"frameId":"2105.1","loaderId":"2105.2","requestId":"2105.1","response":{"connectionId":0,"connectionReused":false,"encodedDataLength":-1,"fromDiskCache":false,"fromServiceWorker":false,"headers":{"Access-Control-Allow-Origin":"*","Content-Type":"text/plain;charset=US-ASCII"},"mimeType":"text/plain","status":200,"statusText":"OK","url":"data:,"},"timestamp":1419487458.92934,"type":"Document"}},"webview":"2C66E956-A48B-456B-8A4E-1022F699AA92"}', u'level': u'INFO'}
                  {u'timestamp': 1419487459178, u'message': u'{"message":{"method":"Network.loadingFinished","params":{"encodedDataLength":0,"requestId":"2105.1","timestamp":1419487458.92936}},"webview":"2C66E956-A48B-456B-8A4E-1022F699AA92"}', u'level': u'INFO'}
                  {u'timestamp': 1419487459178, u'message': u'{"message":{"method":"Page.frameNavigated","params":{"frame":{"id":"2105.1","loaderId":"2105.2","mimeType":"text/plain","securityOrigin":"://","url":"data:,"}}},"webview":"2C66E956-A48B-456B-8A4E-1022F699AA92"}', u'level': u'INFO'}
                  ...
                  

                  这篇关于获取 chrome 性能和跟踪日志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:不支持直通,GL 被禁用 下一篇:如何解决此问题元素不可交互的 Selenium Python

                  相关文章

                  最新文章

                2. <i id='sZDRT'><tr id='sZDRT'><dt id='sZDRT'><q id='sZDRT'><span id='sZDRT'><b id='sZDRT'><form id='sZDRT'><ins id='sZDRT'></ins><ul id='sZDRT'></ul><sub id='sZDRT'></sub></form><legend id='sZDRT'></legend><bdo id='sZDRT'><pre id='sZDRT'><center id='sZDRT'></center></pre></bdo></b><th id='sZDRT'></th></span></q></dt></tr></i><div id='sZDRT'><tfoot id='sZDRT'></tfoot><dl id='sZDRT'><fieldset id='sZDRT'></fieldset></dl></div>
                  <legend id='sZDRT'><style id='sZDRT'><dir id='sZDRT'><q id='sZDRT'></q></dir></style></legend>
                    <bdo id='sZDRT'></bdo><ul id='sZDRT'></ul>

                  <small id='sZDRT'></small><noframes id='sZDRT'>

                3. <tfoot id='sZDRT'></tfoot>