How to use the seleniumbase.virtual_display.easyprocess.EasyProcessError function in seleniumbase

To help you get started, we’ve selected a few seleniumbase 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 seleniumbase / SeleniumBase / seleniumbase / virtual_display / easyprocess.py View on Github external
stdout = subprocess.PIPE
            stderr = subprocess.PIPE

        cmd = list(map(uniencode, self.cmd))

        try:
            self.popen = subprocess.Popen(cmd,
                                          stdout=stdout,
                                          stderr=stderr,
                                          cwd=self.cwd,
                                          env=self.env,
                                          )
        except OSError as oserror:
            log.debug('OSError exception: %s', oserror)
            self.oserror = oserror
            raise EasyProcessError(self, 'start error')
        self.is_started = True
        log.debug('process was started (pid=%s)', self.pid)
        return self
github seleniumbase / SeleniumBase / seleniumbase / virtual_display / easyprocess.py View on Github external
def sendstop(self):
        '''
        Kill process (:meth:`subprocess.Popen.terminate`).
        Do not wait for command to complete.

        :rtype: self
        '''
        if not self.is_started:
            raise EasyProcessError(self, 'process was not started!')

        log.debug('stopping process (pid=%s cmd="%s")', self.pid, self.cmd)
        if self.popen:
            if self.is_alive():
                log.debug('process is active -> sending SIGTERM')

                try:
                    try:
                        self.popen.terminate()
                    except AttributeError:
                        os.kill(self.popen.pid, signal.SIGKILL)
                except OSError as oserror:
                    log.debug('exception in terminate:%s', oserror)

            else:
                log.debug('process was already stopped')
github seleniumbase / SeleniumBase / seleniumbase / virtual_display / easyprocess.py View on Github external
def start(self):
        """start command in background and does not wait for it.

        :rtype: self

        """
        if self.is_started:
            raise EasyProcessError(self, 'process was started twice!')

        if self.use_temp_files:
            self._stdout_file = tempfile.TemporaryFile(prefix='stdout_')
            self._stderr_file = tempfile.TemporaryFile(prefix='stderr_')
            stdout = self._stdout_file
            stderr = self._stderr_file

        else:
            stdout = subprocess.PIPE
            stderr = subprocess.PIPE

        cmd = list(map(uniencode, self.cmd))

        try:
            self.popen = subprocess.Popen(cmd,
                                          stdout=stdout,