Class SessionFactory

java.lang.Object
io.webfolder.cdp.session.SessionFactory
All Implemented Interfaces:
AutoCloseable

public class SessionFactory extends Object implements AutoCloseable
  • Constructor Details

  • Method Details

    • connect

      public void connect()
    • create

      public Session create()
      Creates a new page
      Returns:
      this
    • create

      public Session create(SessionSettings settings)
      Creates a new page
      Parameters:
      settings -
      Returns:
      this
    • create

      public Session create(String browserContextId)
      Creates a new page
      Parameters:
      browserContextId - incognito browser context id
      Returns:
      this
    • create

      public Session create(String browserContextId, SessionSettings settings)
      Creates a new page
      Parameters:
      browserContextId - incognito browser context id
      settings -
      Returns:
      this
    • connect

      public Session connect(String targetId)
      Connect to existing session
      Returns:
      this
    • connect

      public Session connect(String targetId, String browserContextId)
    • connect

      public Session connect(String targetId, String browserContextId, String sessionId)
    • connect

      public Session connect(String targetId, String browserContextId, String sessionId, boolean isPage)
    • connect

      public Session connect(String targetId, String browserContextId, String sessionId, boolean isPage, Boolean multiFrameMode)
    • connect

      public Session connect(String targetId, String browserContextId, String sessionId, boolean isPage, Boolean multiFrameMode, SelectorEngine selectorEngine)
    • getBrowserSession

      public Session getBrowserSession()
    • getSessions

      public Map<String,Session> getSessions()
    • getMajorVersion

      public int getMajorVersion()
      Get major version of the browser.
      Returns:
      major version number
    • close

      public void close()
      Terminates this instance of SessionFactory, will also close all created browsers if they are still running. The factory object itself is considered disposed and cannot be used anymore.
      Specified by:
      close in interface AutoCloseable
    • activate

      public void activate(String sessionId)
      Activate this browser window
      Parameters:
      sessionId - session identifier
    • isHeadless

      public boolean isHeadless()
      Tests whether or not a Browser launched with headless argument.
      Returns:
      true if browser launched with headless argument.
    • createBrowserContext

      public String createBrowserContext()
      Creates a new incognito browser context. This won't share cookies/cache with other browser contexts.
    • createBrowserContext

      public String createBrowserContext(String proxyServer, String proxyBypassList)
      Creates a new incognito browser context.
      Parameters:
      proxyServer - Proxy server, similar to the one passed to --proxy-server
      proxyBypassList - Proxy bypass list, similar to the one passed to --proxy-bypass-list This won't share cookies/cache with other browser contexts.
    • disposeBrowserContext

      public void disposeBrowserContext(String browserContextId)
      Dispose incoginto browser context.
    • closed

      public boolean closed()
    • createLoggerFactory

      protected LoggerFactory createLoggerFactory(CdpLoggerType loggerType)
    • addCloseListener

      public boolean addCloseListener(CloseListener listener)
    • removeCloseListener

      public boolean removeCloseListener(CloseListener listener)
    • getOptions

      public Options getOptions()
    • toString

      public String toString()
      Overrides:
      toString in class Object