MCPcopy Create free account
hub / github.com/seleniumbase/SeleniumBase / start

Method start

seleniumbase/undetected/cdp_driver/browser.py:598–732  ·  view source on GitHub ↗

Launches the actual browser.

(self=None)

Source from the content-addressed store, hash-verified

596 return connection
597
598 async def start(self=None) -> Browser:
599 """Launches the actual browser."""
600 if not self:
601 warnings.warn(
602 "Use ``await Browser.create()`` to create a new instance!"
603 )
604 return
605 if self._process or self._process_pid:
606 if self._process.returncode is not None:
607 return await self.create(config=self.config)
608 warnings.warn(
609 "Ignored! This call has no effect when already running!"
610 )
611 return
612 # self.config.update(kwargs)
613 connect_existing = False
614 if self.config.host is not None and self.config.port is not None:
615 connect_existing = True
616 else:
617 self.config.host = "127.0.0.1"
618 self.config.port = util.free_port()
619 if not connect_existing:
620 logger.debug(
621 "BROWSER EXECUTABLE PATH: %s"
622 % self.config.browser_executable_path,
623 )
624 if not pathlib.Path(self.config.browser_executable_path).exists():
625 raise FileNotFoundError(
626 (
627 """
628 ---------------------------------------
629 Could not determine browser executable.
630 ---------------------------------------
631 Browser must be installed in the default location / path!
632 If you are sure about the browser executable,
633 set it using `browser_executable_path='{}` parameter."""
634 ).format(
635 "/path/to/your/browser/executable"
636 if is_posix
637 else "c:/path/to/your/browser.exe"
638 )
639 )
640 if getattr(self.config, "_extensions", None):
641 self.config.add_argument(
642 "--load-extension=%s"
643 % ",".join(str(_) for _ in self.config._extensions)
644 )
645 exe = self.config.browser_executable_path
646 params = self.config()
647 logger.debug(
648 "Starting\n\texecutable :%s\n\narguments:\n%s",
649 exe,
650 "\n\t".join(params),
651 )
652 if not connect_existing:
653 self._process: asyncio.subprocess.Process = (
654 await asyncio.create_subprocess_exec(
655 exe,

Callers 15

uc_open_with_cdp_modeFunction · 0.80
__init__Method · 0.80
reconnectMethod · 0.80
connectMethod · 0.80
start_detachedFunction · 0.80
createMethod · 0.80
beforeTestMethod · 0.80

Calls 9

createMethod · 0.95
HTTPApiClass · 0.85
get_registered_instancesFunction · 0.85
ContraDictClass · 0.85
ConnectionClass · 0.85
add_argumentMethod · 0.80
sleepMethod · 0.45
getMethod · 0.45
sendMethod · 0.45

Tested by

no test coverage detected