Screenshot of the verification code

I want to implement automated login. After entering the username and password, I also need to enter the verification code (as shown below). My idea is to first take a screenshot of the verification code, then perform OCR recognition, and finally automatically enter its value. I use this code in my program to capture the verification code: Take Screenshot selector=#ImgExtraPwd filename=D:/captcha.png. When I run the process, it keeps running in this line. but without reporting any errors or exiting. How can I solve this problem.

Since the element already exposes a src attribute, you can directly extract that value and download the image from the source URL. Once the image is saved locally, pass it to the OCR engine to extract the text. The extracted text can then be fed back into the automation logic for validation or further processing.

1 Like