Class AbstractBrowser
-
- 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()The created drivers by this browser. Map<String, Object>getData()The associated data. BooleanisIdle()Check if this browser is idle. final ScriptConfusergetConfuser()final ScriptLoadergetScriptLoader()final BooleanisGUI()final DurationgetIdleTimeout()BrowserIdgetId()The unique browser id final BrowserSettingsgetBrowserSettings()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. UnitclearCookies()Clear all cookies. 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.common.event.AbstractEventEmitter
getEventExceptionHandler, getListeners, setEventExceptionHandler -
Methods inherited from class ai.platon.pulsar.crawl.fetch.driver.Browser
newDriver -
Methods inherited from class ai.platon.pulsar.common.event.EventEmitter
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()
The created drivers by this browser.
-
getConfuser
final ScriptConfuser getConfuser()
-
getScriptLoader
final ScriptLoader getScriptLoader()
-
getIdleTimeout
final Duration getIdleTimeout()
-
getBrowserSettings
final BrowserSettings getBrowserSettings()
-
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.
-
clearCookies
Unit clearCookies()
Clear all cookies. Notice: even if we clear all cookies, the website still has some technology to track a session.
-
onInitialize
Unit onInitialize()
Initialize the browser.
-
onWillNavigate
Unit onWillNavigate(NavigateEntry entry)
Register event handler before navigating to a url.
-
-
-
-