question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to switch iframe

See original GitHub issue

What is your Scenario?

I am attempting to switch to an iframe using TestCafe.

What is the Current behavior?

When attempting to switch to an iframe, TestCafe does not think that it has loaded and displays the following message:

“Content of the iframe in which the test is currently operating did not load.”

What is the Expected behavior?

TestCafe successfully switches to the iframe

What is your public website URL? (or attach your complete example)

https://www.terrific.ie/dealer/bradys-of-castleknock/finance/45784/13295

Note this vehicle may not be available at some point

What is your TestCafe test code?

import { Selector, t } from "testcafe";

fixture(`Quick Test`);

test
 .page(`https://www.terrific.ie/dealer/bradys-of-castleknock/finance/45784/13295`)(
  `Quick Test`,
  async () => {
      await t
       .click(`.submit-outer`)
       .expect(Selector(`.car-summary-box`).visible)
       .ok()
       .expect(Selector(`.cw-finance-plugin.plugin-loaded`).visible)
       .ok()
       .switchToIframe(`.cw-finance-plugin.plugin-loaded`)
       .click(`.cw-checkmark`)
       .debug();
  });

Your complete configuration file

No response

Your complete test report

No response

Screenshots

No response

Steps to Reproduce

  1. Run the attached code

TestCafe version

1.18.4

Node.js version

v14.19.0

Command-line arguments

testcafe chrome

Browser name(s) and version(s)

Chrome latest

Platform(s) and version(s)

No response

Other

This has been reproduced by Aleksey as per this stackoverflow question:

https://stackoverflow.com/questions/71528890/how-does-testcafe-decide-an-iframe-has-loaded/71558047

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:14 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
kacy-weakleycommented, Jun 9, 2022

We also have this issue, intermittently. In case it helps, try this test sample:

import {Selector} from "testcafe";

fixture`TestCafe Demo Test`
  .beforeEach(async t => {
    await t
    .maximizeWindow()
    .navigateTo("https://mailchimp.com/login")
      .expect(Selector("div").withAttribute("data-mc-el", "loginAnnouncementAnimation")
        .with({ visibilityCheck: true }).exists).ok()
      .typeText(Selector("#username"), "abc123") // Enter your username here
      .typeText(Selector("#password"), "abc123") // Enter your password here
      .click(Selector("button[value='log in']"));
  })

test('Create email campaign', async t => {
  await t.click(Selector("li a").withAttribute("href", "#/create-campaign"))
    .click(Selector("div[role = 'listitem']").withText("Email"))
    .click(Selector("a span").withExactText("Regular"))
    .typeText(Selector("input").withAttribute("name", "textValue"), "Test Campaign")
    .click(Selector("button").withText("Begin"))
    .switchToMainWindow();

  const loadingFrame = Selector("[class *= 'frame'] [class *= 'loading']");
  await loadingFrame();
  if (await loadingFrame.exists) {
    await t
      .expect(loadingFrame.classNames)
      .notMatch(/active/, "container loading frame active", {timeout: 60000})
      .switchToIframe(Selector("#fallback:not([title *='Loading'])").with({visibilityCheck: true, timeout: 30000}));
  }
  await t
    .expect(Selector("[data-dojo-attach-point='itemContent'] img").with({ visibilityCheck: true }).exists).ok({timeout: 20000})
    .click(Selector("button").withText("Design Email"))
    .click(Selector("button").withAttribute("data-dojo-attach-point", "selectInlineEditorButton"))
});
0reactions
Artem-Babichcommented, Sep 23, 2022

Hi @kacy-weakley,

I just tested your code in the latest version of TestCafe and see that the test is completed correctly. Please try the latest version on your side. As for the original issue described in this ticket, unfortunately, we cannot continue our research until we have a simple project illustrating the issue without third-party libraries.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Not able to switch to iframe using Selenium webdriver
Use Below code for handling iframe. WebElement iframe = driver.findElement(By.tagName("iframe")); driver.switchTo().frame(iframe); //Move ...
Read more >
Unable to switch to frame which is inside an iframe
1.Use the following code to switch into the frame: driver.switchTo.frame(content); //now you have switched into the frame · 2.Then you need to ...
Read more >
Issue with chrome driver not able to switch to frame #5401
There was a new bug in chromedriver that isn't waiting for content to load into the iframe before attempting to interact with it,...
Read more >
Switch to Frame does not work - Katalon Community
“Switch to Frame” does not switch to the iFrame. I have verified that iFrame element exists but it failed to Switch to the...
Read more >
SafariDriver fails to switch to frames/iframes? Not currently ...
The below change in switching to iframe in Safari worked perfectly for me. driver.switchTo().frame(driver.findElement(By.id("frame_name")) ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found