Skip to content Skip to sidebar Skip to footer

Saving Image Element Using Splinter Python

How can I save image picture to a file? i tried this way but i have an error. the code is : from splinter import Browser import time with Browser() as browser: url = 'https://pass

Solution 1:

Additional note to @alecxe's answer: splinter doesn't have an interface for getting attribute of web element (i.e. get_attribute method).

Use the following code for getting src of captcha using splinter:

script = "document.getElementById('recaptcha_challenge_image').src"
src = browser.evaluate_script(script)

EDIT: Thanks to @Jérémie! To get src attribute value use following:

src = browser.find_by_id('recaptcha_challenge_image')['src']

Post a Comment for "Saving Image Element Using Splinter Python"