driver = webdriver.Chrome( executable_path=CHROME_DRIVER_PATH)
def login():
driver.get(url_index)
wait = WebDriverWait(driver, 60)
wait.until(EC.visibility_of_element_located((By.XPATH, '//*[@id="Form1"]/div[3]/table/tbody/tr[3]/td[1]/img')))
captcha_elm = driver.find_element(by=By.XPATH, value='//*[@id="Form1"]/div[3]/table/tbody/tr[3]/td[1]/img')
png_path = '1.png'
with open(png_path, 'wb') as file:
file.write(captcha_elm.screenshot_as_png)
参考
https://stackoverflow.com/questions/17361742/download-image-with-selenium-python



