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.

[BUG] Experimental React Selectors doesn't work on react apps in Iframe.

See original GitHub issue

Context:

  • Playwright Version: 1.16.3
  • Operating System: [e.g. Windows, Linux or Mac] Windows
  • Node.js version: [e.g. 12.22, 14.6] 16.13.0
  • Browser: [e.g. All, Chromium, Firefox, WebKit] Chromium
  • Extra: [any specific details about your environment]

Code Snippet

test.describe('Clicking react components', () => {
  let page, frameElementHandle, frame;
  test.beforeAll(async ({browser}) => {
    page = await browser.newPage();
    await page.goto('http://localhost:8080/', {waitUntil: 'domcontentloaded'});
    await page.waitForSelector('iframe#target');
    frameElementHandle = await page.$('#target');
    frame = await frameElementHandle.contentFrame();
  });
  test('click on component named DeepHooks', async () => {
    await frame.click('_react=DeepHooks');
    expect(true).toEqual(true); // Intentional for passing test
  });
})

Describe the bug

It can’t find the component with the selector. Timeout Error of 30 seconds showed up

 Timeout of 30000ms exceeded.

    page.click: Target closed
    =========================== logs ===========================
    waiting for selector "_react=DeepHooks"
    ============================================================

Also, the source is not minified.

I am totally using react selectors for the first time so sorry if I did something wrong.

Thank You

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
dgozmancommented, Dec 7, 2021

@akgupta0777 Your code looks fine. If you could provide a repro scenario for us to run locally, we might be able to help.

0reactions
mxschmittcommented, Dec 19, 2021

Closing for now since we don’t have a repro. Please create a new issue if you still encounter issues.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Create-React-App creates this <iframe> that prevents me from ...
I have found two solutions that can solve this, one with a .env file that sometimes works, and the other solution is with...
Read more >
React v18.0 – React Blog
In our last post, we shared step-by-step instructions for upgrading your app to React 18. In this post, we'll give an overview of...
Read more >
React, Iframes, and a Back-Navigation Bug
In this post, we'll fix a bug where iframes in React interfere with your browser's back-navigation. Skip table of contents. Table of Contents....
Read more >
not - CSS-Tricks
The :not() property in CSS is a negation pseudo class and accepts a simple selector or a selector list as an argument.
Read more >
Iframes with React: Best Practices | by Andrea Perera
Embedding an Iframe inside a React app comes with some risks where Iframe will load content outside your control unless you take the...
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