Rayrun
← Back to Discord Forum

How click iframe or verify are human cloudflare (firefox)?

saitoharugaposted in #help-playwright
Open in Discord

My code:

(async () => {
  const browser = await firefox.launch({
    headless: false
  });
  const context = await browser.newContext();
  const page = await context.newPage();
  await page.goto('about:blank');
  await page.waitForTimeout(1000);
  await page.goto('https://shitflare.asia/');
  await page.waitForTimeout(6000);
  await page.locator('iframe[title="Widget containing a Cloudflare security challenge"]').click(); 
  console.log("nexuy idi");

  // ---------------------
  await context.close();
  await browser.close();
})();```

Does not click on iframe through firefox, how can I click on this checkbox?

This thread is trying to answer question "How can I click on a checkbox within an iframe using Firefox in Playwright?"

29 replies

you're not invoking the iframe. await page.locator('iframe[title="Widget containing a Cloudflare security challenge"]') should be await page.frameLocator(......

saitoharuga
saitoharuga
@chags0: For the Firefox in a different way!!! It won't work the way it does on chrome!!! Therefore, this argument is not informative...

For the Firefox in a different way!!! It won't work the way it does on chrome!!!

Therefore, this argument is not informative...

If it’s an iframe then you need to tell playwright it’s in an iframe. If it’s different for Firefox then show what it looks like in Firefox

@chags0: The iframe couldn't be queried or loaded with Firefox `[<Frame name= url=''>]` , the url is empty and the content of the iframe couldn't be retrieved with `frame.content()`

The iframe couldn't be queried or loaded with Firefox [<Frame name= url=''>] , the url is empty and the content of the iframe couldn't be retrieved with frame.content()

But the iframe is correctly loaded in the browser

And this doesn't happen with Chromium

Can you give an example of what the dom looks like?

@chags0: Sure, just a minute

Sure, just a minute

@chags0: Hey chags, can I dm you the example file?

Hey chags, can I dm you the example file?

@chags0: I've sent you the example, any thoughts?

I've sent you the example, any thoughts?

I didn’t get anything

Maybe my DMs are turned off not sure

You can just post the iframe part

ok i got the DM now that i'm on my computer

regardless of whether you're using firefox or chrome or webkit, you should still locate the frame with frameLocator

for your situation it should be as simple as page.frameLocator("[title=XXXXXXXX"])

@chags0: The example I gave you is calling `page.frameLocator("[title=XXXXXXXX"])`, but the iframe couldn't be loaded correctly with FIrefox

The example I gave you is calling page.frameLocator("[title=XXXXXXXX"]), but the iframe couldn't be loaded correctly with FIrefox

what error are you getting

since you have a reproducible example, create a github issue

Hmmm iframe... Often may contains something or a component.... Likely thing might be premissions we had stuff fail in docker vs running in windoZe specifically for browser permissions think ours was needing the clipboard... But seeing iframe this. might explain it. Then again thought about not posting this suggestion if people are going to be DM and not letting everyone in...

the DM was to not post their private DOM i guess

but the issue is that it works in chromium but in firefox and webit, the iframe is there but the elements under the iframe are not getting loaded. since they have a url that is publicly facing, i think it's a good candidate for the playwright devs to look at

then there might be one other gottcha... Browser differences my exists and they might be using something... Especialy if they are developing something new? Might be pressing the features in the browsers.... https://caniuse.com/

@saitoharuga: any solution ?

any solution ?

@mxschmitt

Double checking he OP's code there is no frame selector...? Really should be a frame selector. Would assert if it works in a browser without requiring a frame selector... Would think you have a security bug that will open up the possibility of a cross site scripting attack...

@dand33: Then what's the way

Then what's the way

@redix: First off would be using a frame locator first, then take it from there...?

First off would be using a frame locator first, then take it from there...?

Related Discord Threads

TwitterGitHubLinkedIn
AboutQuestionsDiscord ForumBrowser ExtensionTagsQA Jobs

Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email luc@ray.run.