img = driver.find_element_by_xpath("//img[@alt="Google"]") img_base64 = browser.execute_script(""" var ele = arguments[0]; var cnv = document.createElement('canvas'); cnv.width = ele.width; cnv.height = ele.height; cnv.getContext('2d').drawImage(ele, 0, 0); return cnv.toDataURL('image/jpeg').substring(22); """, browser.find_element_by_xpath("//your_xpath")) with open(r"save.jpg", 'wb') as f: f.write(base64.b64decode(img_base64))