Reputation: 443
I have problem with my test in Protractor.
I need something like this:
'Find iframe, click on it, and then set value to the ng-model.'
So my code looks like:
browser.switchTo().frame(element(by.model('myModel')).getWebElement());
browser.findElement(by.className('testClass')).click();
var elm = element(by.model("myModel"));
elm.evaluate("fields.myModel = 'test';");
But unfortunately I have error like below:
Failed: Error while waiting for Protractor to sync with the page:
"both angularJS testability and angular testability are 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 http://git.io/v4gXM for details
This page is angular page and I don't know how to deal with it. I can't use 'browser.ignoreSynchronization=true', because then I have error, that angular is not defined. I can't also refresh browser because then I lose my content (it shows up afer clicking), so I don't know how can I do this.
Many thanks for any tips.
Upvotes: 1
Views: 2001
Reputation: 694
Iframes and protractor do not get along well. I use browser.waitForAngularEnabled();
, then do the checks, and then switch back.
Example:
browser.waitForAngularEnabled(false);
browser.switchTo().frame(iFrame)
//Do stuff inside iframe here. You should be treating this as a non angular page
browser.switchTo().defaultContent();
browser.waitForAngularEnabled(true);
Upvotes: 4