My code looks like this at the moment:
captcha_img = driver.find_element_by_class_name('ng-star-inserted')
I want to download the image.
Please help.
My code looks like this at the moment:
captcha_img = driver.find_element_by_class_name('ng-star-inserted')
I want to download the image.
Please help.
Another option (we get the url address from the src
attribute, then we download and write the file):
Imports :
import requests
from PIL import Image
Code :
url= driver.find_element_by_class_name('ng-star-inserted').get_attribute("src")
img = Image.open(requests.get(url, stream = True).raw)
img.save('image.jpg')
Reference : https://pillow.readthedocs.io/en/4.2.x/releasenotes/2.8.0.html#id1