In the system that I'm testing captcha appears very rarely, but when it does, it's out of the blue(I can't guess when) after I submit the form. Form data is preserved, user just needs to solve the captcha(solving is not an issue in my case).
The problem is that I don't know when the captcha will appear and just blindly looking for each in the [AfterStep] hook is shot in the foot as it will block each step for implicit wait time.
My solutions are:
- After each step where I confirm a form I add a step
And Fill captcha if necessary
This is bad because I add 50 steps to the whole test suite and 49 out of them are usually useless + Driver.FindElement is a blocking call so it will wait 49*20seconds for the captcha that will never appear.
- Browser gets HTTP code
Xwhen the captcha will appear after form submission so I could listen to the codes in the separate thread and once I hit codeXI will look for captcha, fill and resubmit form.
This is bad because I found endless discussions stating that Selenium doesn't support it and I can't listen status codes, I don't think that has changed in recent times.
I will probably go with the 1. solution as this is the only one I know that will work, but I might be missing something.
Question: Are there any other solutions to this problem?