Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Testing angular app with recaptcha #53

Open
igarifullin opened this issue Oct 31, 2016 · 4 comments
Open

Testing angular app with recaptcha #53

igarifullin opened this issue Oct 31, 2016 · 4 comments

Comments

@igarifullin
Copy link

I have the angular app with recaptcha in login form. So I switch driver to recaptcha frame and click on checkbox. After this I switch back to the parent frame, find element on main form- and at this moment waitforangular waiting for recaptcha reset script ends. So I need to skip this, it is possible?

@rendmath
Copy link

rendmath commented Nov 4, 2016

Would it be possible for you to provide more details about what you mean by "waitforangular waiting for recaptcha reset script ends"? Could you provide us with code to reproduce the issue?

Here is some sample code checking a Recaptcha on the Angular Recaptcha demo website. As you might imagine, this version is too simplistic to fool the captcha library.

using (var ngDriver = new NgWebDriver(new ChromeDriver(), "[ng-app]"))
{
    ngDriver.Manage().Timeouts().SetScriptTimeout(TimeSpan.FromSeconds(10));
    ngDriver.Url = "http://vividcortex.github.io/angular-recaptcha/";

    var frame = ngDriver.FindElement(By.TagName("iframe"));
    ngDriver.SwitchTo().Frame(frame);

    ngDriver.IgnoreSynchronization = true;
    var checkmark = ngDriver.FindElement(By.ClassName("recaptcha-checkbox-checkmark"));
    checkmark.Click();
    ngDriver.IgnoreSynchronization = false;

    ngDriver.SwitchTo().ParentFrame();
    ngDriver.FindElement(By.CssSelector("[vc-recaptcha]")).Click();
}

@igarifullin
Copy link
Author

Oh no, I'm using the test recaptcha key to always pass it.
So this is my code - http://stackoverflow.com/questions/40346134/testing-angular-with-protractor-net-wrapper

After switching to parent frame (or previous window) the WaitForAngular script is waiting for nothing- and timeout fails.
You should try to reduce my case. May be you'll solve this problem

@rendmath
Copy link

rendmath commented Nov 4, 2016

Does switching IgnoreSynchronization have any effect on your problem?
Unless you provide us with a public facing page to reproduce the issue, it might prove difficult to solve.

@gilsdav
Copy link

gilsdav commented Dec 5, 2018

This fixed my issue on my project

clickOnNav() navigate to another page that contains Recaptcha.

Solution:

it('should navigate to recaptcha page', async () => {
    page.navigateTo();
    page.clickOnNav();
    browser.ignoreSynchronization = true; // Fix because of recaptcha
    browser.sleep(500);
    expect(page.getElementStepper()).toBeTruthy();
    browser.ignoreSynchronization = false;
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants