-
- All Implemented Interfaces:
-
ai.platon.pulsar.crawl.fetch.driver.WebDriver,java.io.Closeable,java.lang.AutoCloseable,kotlin.Comparable
public abstract class AbstractWebDriver implements Comparable<AbstractWebDriver>, WebDriver
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public enumAbstractWebDriver.Status
-
Field Summary
Fields Modifier and Type Field Description private DurationwaitForTimeoutprivate InstantlastActiveTimeprivate DurationidleTimeoutprivate final Stringnameprivate Stringurlprivate final BooleansupportJavascriptprivate final BooleanisMockedPageSourceprivate final AtomicReference<AbstractWebDriver.Status>statusprivate final BooleanisFreeprivate final BooleanisWorkingprivate final BooleanisNotWorkingprivate final BooleanisCrashedprivate final BooleanisRetiredprivate final BooleanisCanceledprivate final BooleanisQuitprivate final BrowserInstancebrowserInstanceprivate final Integeridprivate final BrowserInstanceIdbrowserInstanceIdprivate final BooleanisIdleprivate final BrowserTypebrowserTypeprivate final StringsessionIdprivate final Function1<String, Long>delayPolicy
-
Constructor Summary
Constructors Constructor Description AbstractWebDriver(BrowserInstance browserInstance, Integer id)
-
Method Summary
Modifier and Type Method Description final DurationgetWaitForTimeout()final UnitsetWaitForTimeout(Duration waitForTimeout)InstantgetLastActiveTime()UnitsetLastActiveTime(Instant lastActiveTime)DurationgetIdleTimeout()UnitsetIdleTimeout(Duration idleTimeout)StringgetName()StringgetUrl()The url to navigate The browser might redirect, so it might not be the same with currentUrl() UnitsetUrl(String url)The url to navigate The browser might redirect, so it might not be the same with currentUrl() BooleangetSupportJavascript()Whether the web driver has javascript support BooleangetIsMockedPageSource()Whether the web page source is mocked final AtomicReference<AbstractWebDriver.Status>getStatus()Driver status final BooleangetIsFree()final BooleangetIsWorking()final BooleangetIsNotWorking()final BooleangetIsCrashed()BooleangetIsRetired()BooleangetIsCanceled()BooleangetIsQuit()BrowserInstancegetBrowserInstance()IntegergetId()BrowserInstanceIdgetBrowserInstanceId()BooleangetIsIdle()abstract BrowserTypegetBrowserType()abstract StringgetSessionId()Function1<String, Long>getDelayPolicy()Unitfree()UnitstartWork()Unitretire()Unitcancel()LongwaitForSelector(String selector, Long timeoutMillis)Returns when element specified by selector satisfies {@code state} option. LongwaitForSelector(String selector)Returns when element specified by selector satisfies {@code state} option. LongwaitForNavigation()LongwaitForNavigation(Long timeoutMillis)ObjectevaluateSilently(String expression)UnitscrollDown(Integer count)UnitscrollUp(Integer count)StringouterHTML(String selector)StringfirstText(String selector)List<String>allTexts(String selector)StringfirstAttr(String selector, String attrName)List<String>allAttrs(String selector, String attrName)ConnectionnewSession()Create a new session with the same context of the browser: headers, cookies, proxy, etc. Connection.ResponseloadResource(String url)Booleanequals(Object other)IntegerhashCode()IntegercompareTo(AbstractWebDriver other)StringtoString()-
Methods inherited from class ai.platon.pulsar.crawl.fetch.driver.AbstractWebDriver
bringToFront, click, currentUrl, evaluate, exists, getCookies, mainRequestCookies, mainRequestHeaders, navigateTo, pageSource, quit, scrollTo, setTimeouts, stop, type, waitForNavigation, waitForSelector -
Methods inherited from class ai.platon.pulsar.crawl.fetch.driver.WebDriver
close -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
AbstractWebDriver
AbstractWebDriver(BrowserInstance browserInstance, Integer id)
-
-
Method Detail
-
getWaitForTimeout
final Duration getWaitForTimeout()
-
setWaitForTimeout
final Unit setWaitForTimeout(Duration waitForTimeout)
-
getLastActiveTime
Instant getLastActiveTime()
-
setLastActiveTime
Unit setLastActiveTime(Instant lastActiveTime)
-
getIdleTimeout
Duration getIdleTimeout()
-
setIdleTimeout
Unit setIdleTimeout(Duration idleTimeout)
-
getUrl
String getUrl()
The url to navigate The browser might redirect, so it might not be the same with currentUrl()
-
setUrl
Unit setUrl(String url)
The url to navigate The browser might redirect, so it might not be the same with currentUrl()
-
getSupportJavascript
Boolean getSupportJavascript()
Whether the web driver has javascript support
-
getIsMockedPageSource
Boolean getIsMockedPageSource()
Whether the web page source is mocked
-
getStatus
final AtomicReference<AbstractWebDriver.Status> getStatus()
Driver status
-
getIsWorking
final Boolean getIsWorking()
-
getIsNotWorking
final Boolean getIsNotWorking()
-
getIsCrashed
final Boolean getIsCrashed()
-
getIsRetired
Boolean getIsRetired()
-
getIsCanceled
Boolean getIsCanceled()
-
getBrowserInstance
BrowserInstance getBrowserInstance()
-
getBrowserInstanceId
BrowserInstanceId getBrowserInstanceId()
-
getBrowserType
abstract BrowserType getBrowserType()
-
getSessionId
abstract String getSessionId()
-
getDelayPolicy
Function1<String, Long> getDelayPolicy()
-
waitForSelector
Long waitForSelector(String selector, Long timeoutMillis)
Returns when element specified by selector satisfies {@code state} option. Returns the time remaining until timeout
-
waitForSelector
Long waitForSelector(String selector)
Returns when element specified by selector satisfies {@code state} option.
-
waitForNavigation
Long waitForNavigation()
-
waitForNavigation
Long waitForNavigation(Long timeoutMillis)
-
evaluateSilently
Object evaluateSilently(String expression)
-
scrollDown
Unit scrollDown(Integer count)
-
newSession
Connection newSession()
Create a new session with the same context of the browser: headers, cookies, proxy, etc. The browser should be initialized by opening a page before the session is created.
-
loadResource
Connection.Response loadResource(String url)
-
compareTo
Integer compareTo(AbstractWebDriver other)
-
-
-
-