-
- All Implemented Interfaces:
-
ai.platon.pulsar.common.event.EventEmitter,ai.platon.pulsar.crawl.fetch.driver.Browser,java.lang.AutoCloseable
public abstract class AbstractBrowser extends AbstractEventEmitter<BrowserEvents> implements Browser
-
-
Field Summary
Fields Modifier and Type Field Description private final StringuserAgentprivate final NavigateHistorynavigateHistoryprivate final Map<String, WebDriver>driversprivate final Map<String, Object>dataprivate final BooleanisIdleprivate final ScriptConfuserconfuserprivate final ScriptLoaderscriptLoaderprivate final BooleanisGUIprivate final DurationidleTimeoutprivate final BrowserIdidprivate final BrowserSettingsbrowserSettingsprivate Function1<Throwable, Unit>eventExceptionHandlerprivate final Map<BrowserEvents, List<Function<Object>>>listeners
-
Constructor Summary
Constructors Constructor Description AbstractBrowser(BrowserId id, BrowserSettings browserSettings)
-
Method Summary
Modifier and Type Method Description StringgetUserAgent()The user agent to override, do not override if it's null. NavigateHistorygetNavigateHistory()The navigation history. Map<String, WebDriver>getDrivers()Map<String, Object>getData()The associated data. BooleangetIsIdle()final ScriptConfusergetConfuser()final ScriptLoadergetScriptLoader()final BooleangetIsGUI()final DurationgetIdleTimeout()BrowserIdgetId()The unique browser id final BrowserSettingsgetBrowserSettings()final Function1<Throwable, Unit>getEventExceptionHandler()final UnitsetEventExceptionHandler(Function1<Throwable, Unit> eventExceptionHandler)final Map<BrowserEvents, List<Function<Object>>>getListeners()UnitdestroyDriver(WebDriver driver)Destroy the web driver, close the associated browser tabs. UnitdestroyForcibly()Destroy the browser forcibly, kill the associated browser processes, release all allocated resources, regardless of whether the browser is closed or not. Unitmaintain()Maintain the browser UnitonInitialize()Initialize the browser. UnitonWillNavigate(NavigateEntry entry)Register event handler before navigating to a url. Unitclose()-
Methods inherited from class ai.platon.pulsar.crawl.fetch.driver.AbstractBrowser
newDriver -
Methods inherited from class ai.platon.pulsar.crawl.fetch.driver.Browser
count, emit, emit, emit, emit, emit1, emit1, emit1, emit1, hasListeners, hasNormalListeners, hasSuspendListeners, listeners, listeners, normalListeners, normalListeners, off, off, off, off, off, off1, off1, off1, off1, off1, on, on, on, on, on1, on1, on1, on1, once, once, once, once1, once1, once1, suspendListeners, suspendListeners -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
AbstractBrowser
AbstractBrowser(BrowserId id, BrowserSettings browserSettings)
-
-
Method Detail
-
getUserAgent
String getUserAgent()
The user agent to override, do not override if it's null.
-
getNavigateHistory
NavigateHistory getNavigateHistory()
The navigation history.
-
getDrivers
Map<String, WebDriver> getDrivers()
-
getConfuser
final ScriptConfuser getConfuser()
-
getScriptLoader
final ScriptLoader getScriptLoader()
-
getIdleTimeout
final Duration getIdleTimeout()
-
getBrowserSettings
final BrowserSettings getBrowserSettings()
-
getEventExceptionHandler
final Function1<Throwable, Unit> getEventExceptionHandler()
-
setEventExceptionHandler
final Unit setEventExceptionHandler(Function1<Throwable, Unit> eventExceptionHandler)
-
getListeners
final Map<BrowserEvents, List<Function<Object>>> getListeners()
-
destroyDriver
Unit destroyDriver(WebDriver driver)
Destroy the web driver, close the associated browser tabs.
-
destroyForcibly
Unit destroyForcibly()
Destroy the browser forcibly, kill the associated browser processes, release all allocated resources, regardless of whether the browser is closed or not.
-
maintain
Unit maintain()
Maintain the browser
-
onInitialize
Unit onInitialize()
Initialize the browser.
-
onWillNavigate
Unit onWillNavigate(NavigateEntry entry)
Register event handler before navigating to a url.
-
close
Unit close()
-
-
-
-