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

Method get

seleniumbase/undetected/cdp_driver/browser.py:345–596  ·  view source on GitHub ↗

Top level get. Utilizes the first tab to retrieve given url. Convenience function known from selenium. This function detects when DOM events have fired during navigation. :param url: The URL to navigate to :param new_tab: Open new tab :param new_window: O

(
        self,
        url="about:blank",
        new_tab: bool = False,
        new_window: bool = False,
        **kwargs,
    )

Source from the content-addressed store, hash-verified

343 await tab.send(cdp.fetch.enable(handle_auth_requests=True))
344
345 async def get(
346 self,
347 url="about:blank",
348 new_tab: bool = False,
349 new_window: bool = False,
350 **kwargs,
351 ) -> tab.Tab:
352 """Top level get. Utilizes the first tab to retrieve given url.
353 Convenience function known from selenium.
354 This function detects when DOM events have fired during navigation.
355 :param url: The URL to navigate to
356 :param new_tab: Open new tab
357 :param new_window: Open new window
358 :return: Page
359 """
360 await asyncio.sleep(0.005)
361 if url and ":" not in url:
362 url = "https://" + url
363 if new_tab or new_window:
364 # Create new target using the browser session.
365 target_id = await self.connection.send(
366 cdp.target.create_target(
367 url, new_window=new_window, enable_begin_frame_control=True
368 )
369 )
370 connection: tab.Tab = next(
371 filter(
372 lambda item: (
373 item.type_ == "page" and item.target_id == target_id
374 ),
375 self.targets,
376 )
377 )
378 connection.browser = self
379 else:
380 try:
381 # Most recently opened tab
382 connection = self.targets[-1]
383 await connection.sleep(0.005)
384 except Exception:
385 # First tab from browser.tabs
386 connection: tab.Tab = next(
387 filter(lambda item: item.type_ == "page", self.targets)
388 )
389 await connection.sleep(0.005)
390 _cdp_downloads_path = None
391 _cdp_timezone = None
392 _cdp_user_agent = ""
393 _cdp_locale = None
394 _cdp_platform = None
395 _cdp_disable_csp = None
396 _cdp_geolocation = None
397 _cdp_mobile_mode = None
398 _cdp_recorder = None
399 _cdp_ad_block = None
400 if getattr(sb_config, "_cdp_downloads_path", None):
401 _cdp_downloads_path = sb_config._cdp_downloads_path
402 if getattr(sb_config, "_cdp_timezone", None):

Callers 1

startMethod · 0.45

Calls 10

waitMethod · 0.95
set_authMethod · 0.95
set_downloads_folderMethod · 0.80
set_timezoneMethod · 0.80
set_user_agentMethod · 0.80
set_geolocationMethod · 0.80
sleepMethod · 0.45
sendMethod · 0.45
set_localeMethod · 0.45
evaluateMethod · 0.45

Tested by

no test coverage detected