I want get captcha image from browser. I have got a url of this picture, but the this picture changes each updated time (url is constant).
Is there any solution to get picture from browser (like 'save picture as' button)?
From the other hand, I think it should be work:
- get screenshot of the browser
- get position of picture
- crop captcha from screenshot using opencv
link of the dynamic capcha - link
The problem was solved via screenshot:
browser.save_screenshot('screenshot.png')
img = browser.find_element_by_xpath('//*[@id="cryptogram"]')
loc = img.location
image = cv.LoadImage('screenshot.png', True)
out = cv.CreateImage((150,60), image.depth, 3)
cv.SetImageROI(image, (loc['x'],loc['y'],150,60))
cv.Resize(image, out)
cv.SaveImage('out.jpg', out)
Thanks
question from:
https://stackoverflow.com/questions/17361742/download-image-with-selenium-python 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…