how to handle captcha in selenium webdriver: I am using this code but it gives error"Error communicating with the remote browser. It may have died." code is below: driver.findElement(By.xpath(".recaptcha-checkbox-checkmark")).click();
You can't handle captcha in selenium being one of its major Con. Alternatives are listed as follows:
Using Deathbycapthca API: By using this external service you would be able to send the captcha to them to which in reverse you would be getting text to which you have to enter in the box and submit.
Getting the captcha disabled in test environment if you can.
You can use image recolonization software like Sikuli (http://www.sikuli.org/), it’s an intelligent tool for recognizing the image. It’s an open source tool. But less chance to work for read CAPTCHA but it work good for verify you image ,color and etc.
For simple CAPTCHAs like the one below you can first extract the image with Selenium and then send it to the free OCR.space OCR API for processing. This will return the text inside the (Captcha) image.