title: How to save loaded picture resource using Selenium and Python?
body: <p>I am using Chrome as my browser, and I want to save a captcha to my computer with Selenium. Every time I request from the URL, I get a random image, but I need the one that is displayed on the browser so I can't request for it again.(Getting the src of the image then make another request like using <code>requests</code> will get a different image.)</p>
  
  <p>Take this website as an example (The website I want to get the captcha from has a whitelist so I can't use that):
  <a href="https://unsplash.it/200/300/?random" rel="nofollow noreferrer">https://unsplash.it/200/300/?random</a></p>
  
  <pre><code>from selenium import webdriver
  
  if __name__ == '__main__':
      driver = webdriver.Chrome(r'F:\Dev\ChromeDriver\chromedriver.exe')
      driver.get('https://unsplash.it/200/300/?random')
      img = driver.find_element_by_tag_name('img')
  </code></pre>
  
  <p>Now I can see the picture in the browser, then what should I do to save the same picture to my computer as a file?</p>
  
  <p>P.S. </p>
  
  <ul>
  <li><p><code>img.screenshot('image.png')</code> doesn't work on the website with the captcha.</p></li>
  <li><p>Saving the whole screenshot of the page works, but please let me know a better solution.</p></li>
  </ul>