1

I am writing a script that has to enter an iframe in order to interact with certain inputs. In this case, the inputs are credit card related.

In Chrome head mode, the script runs perfectly fine. In Chrome headless mode, I always get this error: "Content of the iframe in which the test is currently operating did not load.".

I haven't had this problem in other scripts, so I'm assuming it's because these fields are credit card (payment) related, but I'm not finding anything online that confirm my suspisions.

Can anyone confirm or provide insight and is there a workaround (without changing elements)?

Thank you,

1 Answers1

1

Is the iframe content ready at this moment? You can check it by making a screenshot of the whole page via the await t.takeScreenshot() command or the takeOnFails option. If the iframe content on the screenshot looks fine and the cause of the error is unclear, try one of the following workarounds:

  • add some waiting timeouts: await t.wait(timeout)
  • implement a ClientFunction that will check if the iframe content is ready. Here is an example of this approach: https://stackoverflow.com/a/10444444
Dmitry Ostashev
  • 2,305
  • 1
  • 5
  • 21
  • Thanks Dmitry, I'll try the second bulletpoint out as we've already tried the suggestions in the paragraph and first bulletpoint. I'll update with our results. – Justin Braden Oct 03 '22 at 14:17
  • Hey Dmitry, as others have mentioned in that thread, since the elements we need to check are coming from a different domain, there is an Uncaught DOMexception happening: An error occurred in ClientFunction code: SecurityError: Blocked a frame with origin "https://localhost:58444" from accessing a cross-origin frame. – Justin Braden Oct 03 '22 at 20:48
  • Hi @JustinBraden, Thank you for the clarification. Could you try to capture a screenshot at the moment when the test fails? If the iframe looks fine on the image, this behavior is likely caused by TestCafe itself. In this case, I recommend that you open a new issue in the [TestCafe repository](https://github.com/DevExpress/testcafe/issues/new?assignees=&labels=TYPE%3A+bug&template=bug_report.yaml). Please share a sample project or the public URL of the app. – Dmitry Ostashev Oct 07 '22 at 08:11