How to use the pyppeteer.browser.Browser.create function in pyppeteer

To help you get started, we’ve selected a few pyppeteer examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mikeyy / nonoCAPTCHA / solver.py View on Github external
# dont forget to close browser process
        atexit.register(_close_process)
        if self.options.get('handleSIGINT', True):
            signal.signal(signal.SIGINT, _close_process)
        if self.options.get('handleSIGTERM', True):
            signal.signal(signal.SIGTERM, _close_process)
        if not sys.platform.startswith('win'):
            # SIGHUP is not defined on windows
            if self.options.get('handleSIGHUP', True):
                signal.signal(signal.SIGHUP, _close_process)

        connectionDelay = self.options.get('slowMo', 0)
        self.browserWSEndpoint = self._get_ws_endpoint()
        self.connection = Connection(self.browserWSEndpoint, connectionDelay)
        return await Browser.create(
            self.connection, self.options, self.proc, self.killChrome)
github miyakogi / pyppeteer / pyppeteer / launcher.py View on Github external
if logLevel:
        logging.getLogger('pyppeteer').setLevel(logLevel)

    browserWSEndpoint = options.get('browserWSEndpoint')
    if not browserWSEndpoint:
        raise BrowserError('Need `browserWSEndpoint` option.')
    connectionDelay = options.get('slowMo', 0)
    connection = Connection(browserWSEndpoint,
                            options.get('loop', asyncio.get_event_loop()),
                            connectionDelay)
    browserContextIds = (await connection.send('Target.getBrowserContexts')
                         ).get('browserContextIds', [])
    ignoreHTTPSErrors = bool(options.get('ignoreHTTPSErrors', False))
    defaultViewport = options.get('defaultViewport',
                                  {'width': 800, 'height': 600})
    return await Browser.create(
        connection, browserContextIds, ignoreHTTPSErrors, defaultViewport,
        None, lambda: connection.send('Browser.close'))
github mikeyy / nonoCAPTCHA / nonocaptcha / launcher.py View on Github external
async def launch(self):
        self.chromeClosed = False
        self.connection = None
        env = self.options.get("env")
        self.proc = await asyncio.subprocess.create_subprocess_exec(
            *self.cmd,
            stdout=asyncio.subprocess.DEVNULL,
            stderr=asyncio.subprocess.DEVNULL,
            env=env,
        )
        # Signal handlers for exits used to be here
        connectionDelay = self.options.get("slowMo", 0)
        self.browserWSEndpoint = await self._get_ws_endpoint()
        self.connection = Connection(
            self.browserWSEndpoint, self._loop, connectionDelay)
        return await Browser.create(
            self.connection, self.options, self.proc, self.killChrome)
github miyakogi / pyppeteer / pyppeteer / launcher.py View on Github external
if self.handleSIGTERM:
            signal.signal(signal.SIGTERM, _close_process)
        if not sys.platform.startswith('win'):
            # SIGHUP is not defined on windows
            if self.handleSIGHUP:
                signal.signal(signal.SIGHUP, _close_process)

        connectionDelay = self.slowMo
        self.browserWSEndpoint = self._get_ws_endpoint()
        logger.info(f'Browser listening on: {self.browserWSEndpoint}')
        self.connection = Connection(
            self.browserWSEndpoint,
            self._loop,
            connectionDelay,
        )
        browser = await Browser.create(
            self.connection, [], self.ignoreHTTPSErrors, self.defaultViewport,
            self.proc, self.killChrome)
        await self.ensureInitialPage(browser)
        return browser
github mikeyy / nonoCAPTCHA / nonoCAPTCHA / solver.py View on Github external
# dont forget to close browser process
        atexit.register(_close_process)
        if self.options.get("handleSIGINT", True):
            signal.signal(signal.SIGINT, _close_process)
        if self.options.get("handleSIGTERM", True):
            signal.signal(signal.SIGTERM, _close_process)
        if not sys.platform.startswith("win"):
            # SIGHUP is not defined on windows
            if self.options.get("handleSIGHUP", True):
                signal.signal(signal.SIGHUP, _close_process)

        connectionDelay = self.options.get("slowMo", 0)
        self.browserWSEndpoint = self._get_ws_endpoint()
        self.connection = Connection(self.browserWSEndpoint, connectionDelay)
        return await Browser.create(
            self.connection, self.options, self.proc, self.killChrome
        )