-
- 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 classAbstractWebDriver.Companion
-
Field Summary
Fields Modifier and Type Field Description private DurationidleTimeoutprivate DurationwaitForTimeoutprivate final Stringnameprivate final Function1<String, Long>delayPolicyprivate NavigateEntrynavigateEntryprivate final List<NavigateEntry>navigateHistoryprivate final BooleansupportJavascriptprivate final BooleanisMockedPageSourceprivate final AtomicReference<WebDriver.Status>statusprivate InstantlastActiveTimeprivate final BooleanisWorkingprivate final BooleanisNotWorkingprivate final BooleanisRetiredprivate final BooleanisCanceledprivate final BooleanisQuitprivate final BooleanisFreeprivate final BooleanisCrashedprivate final Browserbrowserprivate final Integeridprivate final BrowserInstanceIdbrowserIdprivate final BrowserTypebrowserTypeprivate final BooleanisIdleprivate final StringsessionId
-
Constructor Summary
Constructors Constructor Description AbstractWebDriver(Browser browser, Integer id)
-
Method Summary
-
Methods inherited from class ai.platon.pulsar.crawl.fetch.driver.AbstractWebDriver
addBlockedURLs, addInitScript, awaitTermination, boundingBox, bringToFront, captureScreenshot, captureScreenshot, click, clickMatches, clickMatches, clickablePoint, currentUrl, dragAndDrop, evaluate, exists, getCookies, mainRequestCookies, mainRequestHeaders, mouseWheelDown, mouseWheelUp, moveMouseTo, navigateTo, pageSource, quit, scrollTo, setTimeouts, stop, stopLoading, terminate, type, visible, 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
-
-
Method Detail
-
getIdleTimeout
Duration getIdleTimeout()
-
setIdleTimeout
Unit setIdleTimeout(Duration idleTimeout)
-
getWaitForTimeout
Duration getWaitForTimeout()
-
setWaitForTimeout
Unit setWaitForTimeout(Duration waitForTimeout)
-
getDelayPolicy
Function1<String, Long> getDelayPolicy()
-
getNavigateEntry
NavigateEntry getNavigateEntry()
The url to navigate The browser might redirect, so it might not be the same with currentUrl()
-
setNavigateEntry
Unit setNavigateEntry(NavigateEntry navigateEntry)
The url to navigate The browser might redirect, so it might not be the same with currentUrl()
-
getNavigateHistory
List<NavigateEntry> getNavigateHistory()
-
getSupportJavascript
Boolean getSupportJavascript()
Whether the web driver has javascript support
-
getIsMockedPageSource
Boolean getIsMockedPageSource()
Whether the web page source is mocked
-
getStatus
AtomicReference<WebDriver.Status> getStatus()
Driver status
-
getLastActiveTime
Instant getLastActiveTime()
-
setLastActiveTime
Unit setLastActiveTime(Instant lastActiveTime)
-
getIsWorking
Boolean getIsWorking()
-
getIsNotWorking
final Boolean getIsNotWorking()
-
getIsRetired
Boolean getIsRetired()
-
getIsCanceled
Boolean getIsCanceled()
-
getIsCrashed
Boolean getIsCrashed()
-
getBrowser
Browser getBrowser()
-
getBrowserId
BrowserInstanceId getBrowserId()
-
getBrowserType
abstract BrowserType getBrowserType()
-
getSessionId
abstract String getSessionId()
-
navigateTo
Unit navigateTo(String url)
Returns the main resource response. In case of multiple redirects, the navigation will resolve with the first non-redirect response.
<p> The method will not throw an error when any valid HTTP status code is returned by the remote server, including 404 "Not Found" and 500 "Internal Server Error".- Parameters:
url- URL to navigate page to.
-
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)
-
scrollToTop
Unit scrollToTop()
-
scrollToBottom
Unit scrollToBottom()
-
scrollToMiddle
Unit scrollToMiddle(Float ratio)
-
clickNthAnchor
String clickNthAnchor(Integer n, String rootSelector)
-
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)
-
-
-
-