我试图解析有验证码的网页。验证码由PHP生成:
<img src="/captcha.php" border="0" align="absmiddle">
我做什么:
self.driver = webdriver.Chrome()
img = self.driver.find_element_by_xpath('//table/tbody/tr/td/img')
scr = img.get_attribute('src')
但它包含captcha.php,我希望看到base64。
有没有办法通过php脚本返回该图像?
答案 0 :(得分:0)
from this answer you can download the image:
# download the image
urllib.urlretrieve(src, "captcha.png")