0

I trying to parse web page that has captcha. Captcha is generated by PHP:

<img src="/captcha.php" border="0" align="absmiddle">

What i do:

   self.driver = webdriver.Chrome()
   img = self.driver.find_element_by_xpath('//table/tbody/tr/td/img')
   scr = img.get_attribute('src')

but it contains captcha.php and i expecting to see base64.

Is there any way to get that image return by php script ?

StackUser
  • 243
  • 2
  • 19

1 Answers1

0

from this answer you can download the image:

# download the image
urllib.urlretrieve(src, "captcha.png")
Community
  • 1
  • 1
Breaks Software
  • 1,721
  • 1
  • 10
  • 15
  • 1
    I think you should read "Update" section from that post "The problem with dynamic generated images is that there is a new image generated each time you request it. In that case, you have several options:" – Oleksandr Dashkov Oct 19 '16 at 14:01
  • True. This is the nature of captcha images. I assumed that the OP already knew that it'll be a different image each time they request it, and that they know how they want to deal with that behavior. – Breaks Software Oct 19 '16 at 14:48