How can I bypass reCaptcha v2 in cypress? #29923
Unanswered
sejal-bansal
asked this question in
Questions and Help
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am very new to cypress and have been trying to solve this problem, and nothing seems to work. Can someone please help me?
///
it('Login test', function() {
cy.visit('https://', {
onBeforeLoad(win) {
win.grecaptcha = {
ready: (callback) => {
callback();
},
execute: () => {
return new Promise((resolve) => {
resolve('test');
});
},
render: () => {}
};
}
});
});
2nd Solution:
///
const { HttpStatusCode } = require("axios");
// import 'cypress-iframe'
describe('reCaptcha Bypass', () => {
beforeEach(() => {
cy.intercept('POST', 'https://www.recaptcha.net/recaptcha/api2/', (req) => {
console.log('Intercepted reCaptcha verification request', req);
req.reply({
HttpStatusCode: 200,
body: {
success: true
}
});
}).as('reCaptchaVerify');
});
});
Any help would be appreciated. Thank you!
Beta Was this translation helpful? Give feedback.
All reactions