• <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 截图

        时间:2023-07-04
        <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 截图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:__init__() 接受 2 个位置参数,但使用 WebDriverWait 和 expected_condition 下一篇:Python WebDriver如何打印整个页面源(html)

                  相关文章

                      <bdo id='0XUEd'></bdo><ul id='0XUEd'></ul>
                  1. <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>
                  2. <tfoot id='0XUEd'></tfoot>
                    1. <small id='0XUEd'></small><noframes id='0XUEd'>