0

I am writing tests on a third party system, that utilizes iframes. I have been going through my code and eliminating places where I have been using waits/sleep for 2-5 seconds, and looking more for elements to show.

But, there is one frame, where I have a wait for 90 seconds, because it can take a long time to process, and can take 2 seconds to process in our test system. So, the only way I would know is that the frame is closed and returned back to the main window. I looked to see if I can find out if I am on a frame or a page from the Driver.Instance.... but I can't see anything in particular that could help. What should I look for to see if I am still on a frame, or control has returned to the calling web page?

0

Although, your haven't mentioned the language. Refer below code (Java) to dynamically wait for the iFrame and switch into it

WebDriverWait wait = new WebDriverWait(driver, 60);
wait.until(ExpectedConditions.frameToBeAvailableAndSwitchToIt(frameLocator));

It will wait until your frame gets in into web page and then switch in.

There you can write the code to perform the action on iframe element and then switch back to default window

driver.switchTo().defaultContent();
  • I understand how to close a frame...I am looking on what to look for to know when it closes...if I just close this, and return back to the defaultContent, and it takes more than a second to process, I get this. Element <i class="collapse-icon fa fa-fw fa-refresh"></i> is not clickable at point (1766, 542). Other element would receive the click: <div class="ui-widget-overlay ui-front" style="z-index: 100;"></div>, because the frame is still open, processing. I was hoping for some wait helper for this. – Greg P Feb 5 at 12:48
0

I answered my own question, and went through the wait helper, one by one, and found this one..that I didn't think about.

SeleniumExtras.WaitHelpers.ExpectedConditions.ElementToBeClickable(By.ClassName("collapse"));

Waited for the button to be clickable before clicking on it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.