Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linux non headless not working #54

Open
0-don opened this issue May 20, 2024 · 2 comments
Open

Linux non headless not working #54

0-don opened this issue May 20, 2024 · 2 comments

Comments

@0-don
Copy link

0-don commented May 20, 2024

Why doesn't it open the Chrome window on Linux? I saw your preview video, and you did screenshots on interval. Isn't there a better way just for debugging purposes? Afterwards, using headless as normal would be better.

import { connect } from "puppeteer-real-browser";

connect({
  headless: false,
  turnstile: true,
})
  .then(async (response) => {
    const { browser, page } = response;

    setInterval(async () => {
      await page.screenshot({ path: "./page.jpg" });
    }, 250);
    await page.goto("https://disboard.org/");
  })
  .catch((error) => {
    console.log(error.message);
  });
[don@arch pup]$ node index.mjs 
[ERROR] [PUPPETEER-REAL-BROWSER] | This library is stable with headless: true in linuxt environment and headless: false in Windows environment. Please send headless: 'auto' for the library to work efficiently.
@zfcsoftware
Copy link
Owner

zfcsoftware commented Jun 8, 2024

In fact, the browser opens, but you can't see it because it is launched on a virtual screen. Thanks to xvfb, on Linux operating systems we can launch the browser on a virtual screen instead of on our own screen. The library takes advantage of this feature.
If you delete the following section from the library, browsers will appear.

var xvfbsession = new Xvfb({

If you are talking about the headless feature, it does not work except false. This is because Chrome disables some window properties when new and true. It can be used but not recommended as it will be detected.

https://stackoverflow.com/questions/68289474/selenium-headless-how-to-bypass-cloudflare-detection-using-selenium

@0-don
Copy link
Author

0-don commented Jun 12, 2024

Thanks for the explanation about Xvfb. It seems to work with headless: false on Windows, showing the screen. I know this increases detection risk, but it would be nice to have an option to toggle Xvfb for debugging on other pages in linux.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants