• <bdo id='Wkixo'></bdo><ul id='Wkixo'></ul>

      <tfoot id='Wkixo'></tfoot>

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

      2. <small id='Wkixo'></small><noframes id='Wkixo'>

        Webdriver 截图

        Webdriver Screenshot(Webdriver 截图)
        <i id='w3UbF'><tr id='w3UbF'><dt id='w3UbF'><q id='w3UbF'><span id='w3UbF'><b id='w3UbF'><form id='w3UbF'><ins id='w3UbF'></ins><ul id='w3UbF'></ul><sub id='w3UbF'></sub></form><legend id='w3UbF'></legend><bdo id='w3UbF'><pre id='w3UbF'><center id='w3UbF'></center></pre></bdo></b><th id='w3UbF'></th></span></q></dt></tr></i><div id='w3UbF'><tfoot id='w3UbF'></tfoot><dl id='w3UbF'><fieldset id='w3UbF'></fieldset></dl></div>
        <legend id='w3UbF'><style id='w3UbF'><dir id='w3UbF'><q id='w3UbF'></q></dir></style></legend>

          <bdo id='w3UbF'></bdo><ul id='w3UbF'></ul>
              <tbody id='w3UbF'></tbody>

              <tfoot id='w3UbF'></tfoot>

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

                  本文介绍了Webdriver 截图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  用python在windows上使用Selenium Webdriver截图时,截图直接保存到程序的路径下,有没有办法将.png文件保存到特定目录?

                  When taking a screenshot using Selenium Webdriver on windows with python, the screenshot is saved directly to the path of the program, is there a way to save the .png file to a specific directory?

                  推荐答案

                  使用 driver.save_screenshot('/path/to/file')driver.get_screenshot_as_file('/path/到/文件'):

                  import selenium.webdriver as webdriver
                  import contextlib
                  
                  @contextlib.contextmanager
                  def quitting(thing):
                      yield thing
                      thing.quit()
                  
                  with quitting(webdriver.Firefox()) as driver:
                      driver.implicitly_wait(10)
                      driver.get('http://www.google.com')
                      driver.get_screenshot_as_file('/tmp/google.png') 
                      # driver.save_screenshot('/tmp/google.png')
                  

                  这篇关于Webdriver 截图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  env: python: No such file or directory(env: python: 没有这样的文件或目录)
                  How to evaluate environment variables into a string in Python?(如何在 Python 中将环境变量评估为字符串?)
                  Python - temporarily modify the current process#39;s environment(Python - 临时修改当前进程的环境)
                  Change current process environment#39;s LD_LIBRARY_PATH(更改当前进程环境的 LD_LIBRARY_PATH)
                  Reading and writing environment variables in Python?(在 Python 中读写环境变量?)
                  When to use sys.path.append and when modifying %PYTHONPATH% is enough(何时使用 sys.path.append 以及何时修改 %PYTHONPATH% 就足够了)
                      <bdo id='0XUEd'></bdo><ul id='0XUEd'></ul>
                    • <i id='0XUEd'><tr id='0XUEd'><dt id='0XUEd'><q id='0XUEd'><span id='0XUEd'><b id='0XUEd'><form id='0XUEd'><ins id='0XUEd'></ins><ul id='0XUEd'></ul><sub id='0XUEd'></sub></form><legend id='0XUEd'></legend><bdo id='0XUEd'><pre id='0XUEd'><center id='0XUEd'></center></pre></bdo></b><th id='0XUEd'></th></span></q></dt></tr></i><div id='0XUEd'><tfoot id='0XUEd'></tfoot><dl id='0XUEd'><fieldset id='0XUEd'></fieldset></dl></div>

                      <legend id='0XUEd'><style id='0XUEd'><dir id='0XUEd'><q id='0XUEd'></q></dir></style></legend>
                          <tbody id='0XUEd'></tbody>
                        <tfoot id='0XUEd'></tfoot>
                        1. <small id='0XUEd'></small><noframes id='0XUEd'>