title: Python/Selenium save an image from site to a specific folder instead of script folder
body: <p>I have a code with sekenium that retrieves 100 different captcha images from <a href="https://zefoy.com" rel="nofollow noreferrer">zefoy.com</a>, but the images get saved in the folder my script is in but I want to save them to a specific folder:</p>
  <pre><code>from selenium import webdriver
  from selenium.webdriver.common.by import By
  
  driver = webdriver.Chrome(executable_path=&quot;C:\chromedriver.exe&quot;)
  driver.maximize_window()
  driver.get(&quot;https://zefoy.com&quot;)
  folder = r'C:\Users\fkahd\OneDrive\Bureau\zefoy\captchas'
  
  for i in range(100):
     with open('captcha('+str(i)+').png', 'wb') as file:
        captcha = driver.find_element(By.XPATH, '//*[@id=&quot;main&quot;]/form/div/div/img')
        file.write(captcha.screenshot_as_png) #write to folder
     driver.refresh()
  </code></pre>
  <p>Thanks!</p>