I'm trying to test my application and there is a sign-up page for the e2e test case and a Google recaptcha within the sign-up form.
I tried to use the below code to bypass Google recaptcha code:
browser.switchTo().frame(0).then(function () {
console.log("Inside iFrame ");
var checkbox = $(".recaptcha-checkbox-checkmark");
browser.sleep(5000);
console.log("var checkbox defined.");
// first hover the checkbox
browser.actions().mouseMove(checkbox).perform();
browser.sleep(5000);
console.log("Moved mouse to hover on checkbox");
// hardcoded delay
browser.sleep(500);
browser.sleep(5000);
console.log("Browser sleep completed.");
// okat, now click - TODO: may be we should click with browser.actions().click() and provide the x, y coordinates for where to click
checkbox.click();
browser.sleep(5000);
console.log("clicked checkbox.");
});
I got this code from the Question here.
However, using this code has produced the following error:
Failed: Error while waiting for Protractor to sync with the page: window.angular is undefined. This could be either because this is a non-angular page or because your test involves client-side navigation, which can interfere with Protractor's bootstrapping. See https://github.com/angular/protractor/issues/2643 for details.
Moreover, I put in debugging console logs and whilst they are printing successfully I am still given the error.