please suggest me the best way to automate captcha in cypress automation tool. I am able to click on that checkbox but then the image is opened that needs to be manually done. is there any way to bypass totally recaptcha .
Now I am trying to click on green checkmark button at the bottom in the image. but it is giving me timeout error
Hi @satveerqa:sunglasses:
What you are trying to do is not that easy. The point of captcha is that it cannot be bypassed by bots. As your automated test is nothing else, but a bot, you should not be able to fully automate the captcha.
One solution though to handle this problem is to disable the captcha service in test environment and activate it in production.
Maybe some people here - who are more experienced in automation than me found other alternatives😉
Useful article. My preference would definitely be the semi automated approach, rather than temporarily breaking security, since it does actually mean the test is fully end to end. Obviously a none starter if you have a large, frequent overnight build and test.
Thank you very much @baysha . I saw your post that looks useful for me. I am already able to click on the checkbox then image screen appears that is under the frame. I installed buster captcha extension in my chrome browser and Now I need to click on the that green checkmark under that frame. when execution reached there it gives mere error timeout exception error.
Yeah, basically I have lost so much sleep over this kind of test step which is not a test step. (What’s really happening here in a distorted version of reality, is that you end up testing a 3rd party component but because you are not paying for the 3rd party component testing it is moot to do so.)
Testing the Captcha enforcement is something altogether different and separate, and does not require solving them. Captchas appear when the server is not trusting your IP, so having the server whitelist you will be one way of fixing this in production and in test - while still letting testers test that it is working. That may not work in some cases. but basically unless the test is supposed to test the 3rd part component, don’t do it. Get your devs to give you a bypass of some sort, this will otherwise suck up time better spent detecting product bugs in your product code not in freebie code.
Agree, it’s not easy to push back @satveerqa . At some point, identical environments are not useful, test automation is very often imperfect in itself, for example if you have just installed a browser plugin or any component to work around an “automation” issue, it taints the environment and the test, since the test “jig” (it no longer a normal browser) gradually represents less of the customer typical equipment over time. I would not want to be setting up my entire browser farm of machines with a plugin that may expire at any time, and end up messing you about on a unlucky day in the future. My guess, is it will work for a year or two, which might be enough time, always be tactical. You will want to bring this issue up in the next team retrospective even if this does work around, as it adds risk.
Yes I know identical env are not useful at all, but In case when we have some issue on production then we needs to verify the same thing on QA. then we need both environments same.
I am very close to the solution the only thing is to click on that green icon that is under frame.
I gave the code to identify frame first and then click on that icon under the frame.
Everything costs, and being a tester means you have to choose. It’s still “good” to have identical environments, but not everyone can afford 3 environments. Good to see you are winning with this test case though. Everyone has their own context, and I hope our encouragement helps you to explain to and get more help from your team with some of the pains.
Thanks for your reply. Yup I am just not sure about my code is correct or needs to be improve. because the error says timeout unable to find that element.
is there any way I can add wait in my code so it will keep looking that element and wont fail for some time constraint
Some types of captcha are assessing user behavior before the click - how you move the mouse etc. Or even analyse the browser cookies as evidence of your previous human-like behavior. That’s why they’re effectively impossible to automate. I can’t say whether this applies to your captcha but it seems likely to me.
As for solving the captcha, if I was forced to, I would use a plugin like you are doing.
For intermittent failures I can give this tip.
In my test framework we always take a screenshot, I know cypress has a “movie” mode that will take a video, I’ve never used cypress but I know it can do that. Adapt your test F/W so that it takes a movie and or screenshot and saves it, if the test PASSES, then remember to delete the video or screenshot file since that will save you tonnes of space and prevent other nightmares. Another thing to do is to dump out either the entire DOM when a test fails or to dump out interesting parts of the DOM in the test log. Test automation frameworks are a lot of work and humps like this captcha force you to build out your tooling quite a bit.
I’m tempted to hack that Runescape voting captcha now.
I have done lot of research and wasted time, what I have figured it out, it is not productive to spend time on it to automate captcha, we should suggest our team to disable it for some accounts, let say some test accounts or all of them if it possible. or you can try to bypass login screen but that is also not worth it will take lot of time to run successfully your automation script.