I've got an interesting setup here.
I have an Angular App that loads another Angular App inside an iframe. I'm interested in testing the iframed-in Angular app with Protractor.
Protractor is waiting for the first Angular app to load, but when I switch the iframe with
ptor.switchTo().frame('experience');
I can see that Protractor is not waiting for the iframed Angular app before making assertions. I have tried adding
ptor.waitForAngular();
After switching to the iframe with no luck. Anybody have any ideas what is going on here?
Thanks!
If it helps, I'm running my tests through the Saucelabs ssh tunnel on Chrome. I can tell that the tunneling is working because I see the resources for the iframed app being requested and downloading.
With protractor 2.5.1, @lthilon's answer was giving an 'Invalid Locator' error.
The following syntax resolved that though:
Testing iframes with protractor is a little bit tricky. It took me a while and a lot of patience to sort of understand what was going on. I hope this helps!
Protrator is built upon WebdriverJS, so you can use the whole package to test iframes. When you start testing with protractor, the first thing you do is get an instance of protractor:
But to test what you have inside the iframe you will need ptor.driver instead of ptor!
Then, when you start writing the test, you find the iframe, you switch to it, you test it with 'driver' and you switch back to the initial frame.
The code that follows is a general example of what I mentioned above: