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

puppeteer.launch error #235

Open
zsbox opened this issue May 20, 2023 · 7 comments
Open

puppeteer.launch error #235

zsbox opened this issue May 20, 2023 · 7 comments

Comments

@zsbox
Copy link

zsbox commented May 20, 2023

ProcessException (ProcessException: Operation not permitted
Command: .local-chrome/113.0.5672.63/chrome-mac-x64/Google Chrome for Testing.app/Contents/MacOS/Google Chrome for Testing --allow-pre-commit-input --disable-background-networking --disable-background-timer-throttling --disable-backgrounding-occluded-windows --disable-breakpad --disable-client-side-phishing-detection --disable-component-extensions-with-background-pages --disable-component-update --disable-default-apps --disable-dev-shm-usage --disable-extensions --disable-features=Translate,BackForwardCache,AcceptCHFrame,MediaRouter,OptimizationHints,DIPS --disable-hang-monitor --disable-ipc-flooding-protection --disable-popup-blocking --disable-prompt-on-repost --disable-renderer-backgrounding --disable-sync --enable-automation --enable-blink-features=IdleDetection --enable-features=NetworkServiceInProcess2 --export-tagged-pdf --force-color-profile=srgb --metrics-recording-only --no-first-run --password-store=basic --use-mock-keychain --headless --hide-scrollbars --mute-audio about:blank --remote-debugging-port=0 --user-data-dir=/var/folders/dy/q8b1npfn7d978xwc68vh4tp00000gn/T/com.example.yudi/puppeteer_dev_profile-FJ3WIl)

----- flutter version 3.10.0 ------

I modified this code, there was another error "Websocket url not found", help me?
"< key >com.apple.security.app-sandbox< /key >< false />"

@xvrh
Copy link
Owner

xvrh commented May 20, 2023

@zsbox Can you share a full project that I can run and see the error by myself?

@zsbox
Copy link
Author

zsbox commented May 20, 2023

@xvrh sorry,I think I get it, this plugin only supports dart running, and does not support chrome in-app operation, right, for example, I click a button?

@Shiba-Kar
Copy link

Getting the same error

@Shiba-Kar
Copy link

import 'dart:developer';

import 'package:flutter/material.dart';
import 'package:puppeteer/puppeteer.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(),
      home: const HomeView(),
    );
  }
}

class HomeView extends StatelessWidget {
  const HomeView({super.key});

  @override
  Widget build(BuildContext context) {
    Future run() async {
      try {
        // Download the Chrome binaries, launch it and connect to the "DevTools"
        var browser = await puppeteer.launch();

        // Open a new tab
        var myPage = await browser.newPage();

        // Go to a page and wait to be fully loaded
        await myPage.goto('https://dart.dev', wait: Until.networkIdle);

        // Do something... See other examples
        await myPage.screenshot();
        await myPage.pdf();
        await myPage.evaluate<String>('() => document.title');

        // Gracefully close the browser's process
        await browser.close();
      } catch (e) {
        log(e.toString());
      }
    }

    return Scaffold(
      body: Center(
        child: ElevatedButton(
          child: const Text("Run"),
          onPressed: () => run(),
        ),
      ),
    );
  }
}

@mirkancal
Copy link

@Shiba-Kar where do you run the app? MacOS? iOS? Android?

@Shiba-Kar
Copy link

@Shiba-Kar where do you run the app? MacOS? iOS? Android?
macOS(darwin)

[✓] Flutter (Channel stable, 3.13.6, on macOS 14.0 23A344 darwin-arm64, locale en-IN)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 15.0)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2022.3)
[✓] VS Code (version 1.83.1)
[✓] Connected device (3 available)            
[✓] Network resources

• No issues found!

@mirkancal
Copy link

@Shiba-Kar did you disable sandbox?
#154 (comment)

Additionally you can use already installed chrome path:

final browser = await puppeteer.launch(executablePath: BrowserPath.chrome);

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

4 participants