Skip to content Skip to sidebar Skip to footer

Detecting Whether An Iframe Is Angular Or Not With Protractor

I have the following unusual use case. I detail it below 1) I'm on an angular page & I do some actions on the page [It loads a non-angular iFrame] 2) I switch to the non-angula

Solution 1:

What I normally do when I need to automate an iframe is the following

// 1) When you know the iframe is there
browser.switchTo().frame(0);

// 2 a) You don't need to disable the wait for anguler, just use vanila webdriver, it will work on both
browser.driver.findElement(by.css('.your-css-selector'));
// Do some more interaction
browser.driver.findElement(by.css('.input-css-selector')).sendKeys('type something');
browser.driver.findElement(by.css('.button-css-selector')).click());

// 2b) Or now just use the Protractor syntax, //     because you switched you should be able to use it now.// 3) Switch back
browser.switchTo().defaultContent();

// 4) Check for example with Protractor expectedConditions if the iframe is gonevarEC = protractor.ExpectedConditions;
// Waits for the ifram to be no longer present on the dom.
browser.wait(EC.stalenessOf($('iframe')), 5000);

As you see there is no need to do browser.ignoreSynchronization = true;

I hope this helps

Post a Comment for "Detecting Whether An Iframe Is Angular Or Not With Protractor"