I have tried the many examples already on stack overflow for switching to iframe using protractorjs, none of them have worked for me so far. I was hoping someone else has encountered this issue who may be able to give me some insight.
My Problem: I am able to fill in all the fields on the WorldPay iframe and click submit, but i am unable to find any elements when switching back to the angular application.
See my example code sample below that returns a No Element Found Exception on the last line of code...
browser.waitForAngular();
browser.ignoreSynchronization=true;
browser.switchTo().frame(element(by.tagName('iframe')).getWebElement());
element(by.css("input[data-worldpay='name']")).sendKeys("MR TEST ACCOUNT");
element(by.css("input[data-worldpay='number']")).sendKeys("5555555555554444");
element(by.css("input[data-worldpay='exp-month']")).sendKeys("02");
element(by.css("input[data-worldpay='exp-year']")).sendKeys("2022");
element(by.css("input[data-worldpay='cvc']")).sendKeys("123");
element(by.id("_el_button_save")).click();
browser.switchTo().defaultContent();
browser.waitForAngular();
browser.ignoreSynchronization=false;
element(by.id("button_confirm")).click();
Other things I've tried
- I have also tried using browser.waitForAngularEnabled(false) and then browser.waitForAngularEnabled(true) which resulted in the same issue
- I have tried switching to defaultContent AFTER waiting for angular to be enabled again/ setting ignoreSynchronization to false
- Instead of using "browser.switchTo().defaultContent();" using "browser.switchTo().frame(element(by.tagName('button_confirm')).getWebElement());" which yields the same result