I want to get a captcha image from the browser. I have got a URL of this picture, but this picture changes each updated time (URL is constant).
Is there any solution to get a picture from the browser (like 'save picture as' button)?
From the other hand, I think it should be work:
- get screenshot of the browser
- get the position of the picture
- crop captcha from screenshot using OpenCV link of the dynamic captcha
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 in advance!