0

I am trying to use wait to wait for frame to be loaded..problem is only paramters accepted for frames are int, string, or webelement...I am able to use waits to change to other frames but not the actual Parent frame itself (or the Default Frame)...

// this works to switch to the iframe with string "Apple"

iframe = wait.until(ExpectedConditions.frameToBeAvailableAndSwitchToIt("Apple"));

// this doesn't work to switch back to the defaultContent frame...

defaultContent = wait.until(ExpectedConditions.frameToBeAvailableAndSwitchToIt(???))

guessing since defaultContent is a different datatype (Webdriver)..any way how i can wait for the parent frame to load??

1 Answers1

0

In case the default content you mention is achieve by this code:

driver.switchTo().defaultContent();

I think the answer is no.

REASON:

Because default content is not a frame, it is a Top Window. The Top Window contains the other iframes and the framesets. In order to interact with element inside iframe, dev need to switch to respective iframe.

iframe = wait.until(ExpectedConditions.frameToBeAvailableAndSwitchToIt("Apple"));

The method you mention only work with iframe element, so it not work with Top Window. But you still can wait for Top Window by using other work around

Wait until page is loaded with Selenium WebDriver for Python


In case your parent frame is another iframe, so yes. You can use

frameToBeAvailableAndSwitchToIt()

to wait and switch back to parent frame when it available.

Trinh Phat
  • 524
  • 3
  • 6