-
- All Implemented Interfaces:
-
ai.platon.pulsar.crawl.fetch.driver.JvmWebDriver,ai.platon.pulsar.crawl.fetch.driver.WebDriver,java.io.Closeable,java.lang.AutoCloseable,kotlin.Comparable
public final class ChromeDevtoolsDriver extends AbstractWebDriver
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classChromeDevtoolsDriver.Companion
-
Field Summary
Fields Modifier and Type Field Description private final BrowserTypebrowserTypeprivate final IntegeropenSequenceprivate final FloatresourceBlockProbabilityprivate final List<String>blockedURLsprivate final List<String>probabilityBlockedURLsprivate InstantlastActiveTimeprivate final BooleanisGoneprivate final BooleanisActiveprivate final RemoteDevToolsimplementationprivate final StringsessionIdprivate final ChromeTabchromeTabprivate final RemoteDevToolsdevToolsprivate final BrowserSettingsbrowserSettingsprivate final ChromeDevtoolsBrowserbrowserprivate final Function1<String, Long>delayPolicyprivate final Integeridprivate DurationidleTimeoutprivate final BooleanisCanceledprivate final BooleanisCrashedprivate final BooleanisFreeprivate final BooleanisIdleprivate final BooleanisInitprivate final BooleanisMockedPageSourceprivate final BooleanisQuitprivate final BooleanisReadyprivate BooleanisRecoveredprivate final BooleanisRetiredprivate BooleanisReusedprivate final BooleanisWorkingprivate final List<Map<String, String>>mainRequestCookiesprivate final Map<String, Object>mainRequestHeadersprivate final Map<String, Object>mainResponseHeadersprivate final IntegermainResponseStatusprivate final StringmainResponseStatusTextprivate final Stringnameprivate NavigateEntrynavigateEntryprivate final List<NavigateEntry>navigateHistoryprivate final AtomicReference<WebDriver.State>stateprivate final BooleansupportJavascriptprivate DurationwaitForElementTimeout
-
Constructor Summary
Constructors Constructor Description ChromeDevtoolsDriver(ChromeTab chromeTab, RemoteDevTools devTools, BrowserSettings browserSettings, ChromeDevtoolsBrowser browser)
-
Method Summary
-
Methods inherited from class ai.platon.pulsar.protocol.browser.driver.cdt.ChromeDevtoolsDriver
allAttrs, allTexts, cancel, check, clickMatches, clickNthAnchor, clickTextMatches, compareTo, equals, evaluateSilently, firstAttr, firstText, free, hashCode, isChecked, jvm, loadResource, navigateTo, newSession, outerHTML, quit, retire, scrollDown, scrollToBottom, scrollToMiddle, scrollToTop, scrollUp, startWork, uncheck, waitForNavigation, waitForNavigation, waitForSelector, waitForSelector -
Methods inherited from class ai.platon.pulsar.crawl.fetch.driver.AbstractWebDriver
addBlockedURLsAsync, addInitScriptAsync, allAttrsAsync, allTextsAsync, boundingBoxAsync, bringToFrontAsync, captureScreenshotAsync, captureScreenshotAsync, checkAsync, clickAsync, clickMatchesAsync, clickMatchesAsync, clickNthAnchorAsync, clickablePointAsync, currentUrlAsync, dragAndDropAsync, evaluateAsync, evaluateSilentlyAsync, existsAsync, firstAttrAsync, firstTextAsync, getCookiesAsync, isCheckedAsync, isHiddenAsync, isVisibleAsync, loadResourceAsync, mainRequestCookiesAsync, mainRequestHeadersAsync, mouseWheelDownAsync, mouseWheelUpAsync, moveMouseToAsync, navigateToAsync, navigateToAsync, newSessionAsync, outerHTMLAsync, pageSourceAsync, pauseAsync, scrollDownAsync, scrollToAsync, scrollToBottomAsync, scrollToMiddleAsync, scrollToTopAsync, scrollUpAsync, setTimeoutsAsync, stopAsync, terminateAsync, typeAsync, uncheckAsync, visibleAsync, waitForNavigationAsync, waitForNavigationAsync, waitForNavigationAsync, waitForSelectorAsync, waitForSelectorAsync, waitForSelectorAsync -
Methods inherited from class ai.platon.pulsar.crawl.fetch.driver.AbstractJvmWebDriver
clickAsync, clickMatches, clickMatchesAsync, isHidden, stopLoading, visible -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
ChromeDevtoolsDriver
ChromeDevtoolsDriver(ChromeTab chromeTab, RemoteDevTools devTools, BrowserSettings browserSettings, ChromeDevtoolsBrowser browser)
-
-
Method Detail
-
getBrowserType
BrowserType getBrowserType()
-
getOpenSequence
final Integer getOpenSequence()
-
getResourceBlockProbability
final Float getResourceBlockProbability()
-
getBlockedURLs
final List<String> getBlockedURLs()
-
getProbabilityBlockedURLs
final List<String> getProbabilityBlockedURLs()
-
getLastActiveTime
Instant getLastActiveTime()
-
setLastActiveTime
Unit setLastActiveTime(Instant lastActiveTime)
-
getIsActive
final Boolean getIsActive()
-
getImplementation
final RemoteDevTools getImplementation()
-
getSessionId
String getSessionId()
-
getChromeTab
final ChromeTab getChromeTab()
-
getDevTools
final RemoteDevTools getDevTools()
-
getBrowserSettings
final BrowserSettings getBrowserSettings()
-
getBrowser
ChromeDevtoolsBrowser getBrowser()
-
getDelayPolicy
Function1<String, Long> getDelayPolicy()
-
getIdleTimeout
Duration getIdleTimeout()
-
setIdleTimeout
Unit setIdleTimeout(Duration idleTimeout)
-
getIsCanceled
Boolean getIsCanceled()
-
getIsCrashed
Boolean getIsCrashed()
-
getIsMockedPageSource
Boolean getIsMockedPageSource()
-
getIsReady
Boolean getIsReady()
-
getIsRecovered
Boolean getIsRecovered()
-
setIsRecovered
Unit setIsRecovered(Boolean isRecovered)
-
getIsRetired
Boolean getIsRetired()
-
getIsReused
Boolean getIsReused()
-
setIsReused
Unit setIsReused(Boolean isReused)
-
getIsWorking
Boolean getIsWorking()
-
getMainRequestCookies
List<Map<String, String>> getMainRequestCookies()
-
getMainRequestHeaders
Map<String, Object> getMainRequestHeaders()
-
getMainResponseHeaders
Map<String, Object> getMainResponseHeaders()
-
getMainResponseStatus
Integer getMainResponseStatus()
-
getMainResponseStatusText
String getMainResponseStatusText()
-
getNavigateEntry
NavigateEntry getNavigateEntry()
-
setNavigateEntry
Unit setNavigateEntry(NavigateEntry navigateEntry)
-
getNavigateHistory
List<NavigateEntry> getNavigateHistory()
-
getState
AtomicReference<WebDriver.State> getState()
-
getSupportJavascript
Boolean getSupportJavascript()
-
getWaitForElementTimeout
Duration getWaitForElementTimeout()
-
setWaitForElementTimeout
Unit setWaitForElementTimeout(Duration waitForElementTimeout)
-
addInitScript
Unit addInitScript(String script)
-
addBlockedURLs
Unit addBlockedURLs(List<String> urls)
-
addProbabilityBlockedURLs
Unit addProbabilityBlockedURLs(List<String> urls)
-
setTimeouts
Unit setTimeouts(BrowserSettings browserSettings)
-
navigateTo
Unit navigateTo(NavigateEntry entry)
-
mainRequestHeaders
Map<String, Object> mainRequestHeaders()
-
mainRequestCookies
List<Map<String, String>> mainRequestCookies()
-
getCookies
List<Map<String, String>> getCookies()
-
evaluateDetail
JsEvaluation evaluateDetail(String expression)
-
currentUrl
String currentUrl()
-
waitForSelector
Long waitForSelector(String selector, Duration timeout)
-
waitForNavigation
Long waitForNavigation(Duration timeout)
-
waitForPage
WebDriver waitForPage(String url, Duration timeout)
-
moveMouseTo
Unit moveMouseTo(Double x, Double y)
TODO: test is required
-
moveMouseTo
Unit moveMouseTo(String selector, Integer deltaX, Integer deltaY)
-
click
Unit click(String selector, Integer count)
This method fetches an element with
selector, scrolls it into view if needed, and then uses {@link Mouse} to click in the center of the element. If there's no element matchingselector, the method do not click anything.- Parameters:
selector-A
selectorto search for element to click. If there are multiple elements satisfying theselector, the first will be clicked
count-Click count
-
dragAndDrop
Unit dragAndDrop(String selector, Integer deltaX, Integer deltaY)
-
clickablePoint
PointD clickablePoint(String selector)
-
boundingBox
RectD boundingBox(String selector)
-
captureScreenshot
String captureScreenshot(String selector)
This method scrolls element into view if needed, and then uses {@link page.captureScreenshot} to take a screenshot of the element. If the element is detached from DOM, the method throws an error.
-
captureScreenshot
String captureScreenshot(RectD clip)
-
pageSource
String pageSource()
-
bringToFront
Unit bringToFront()
-
awaitTermination
Unit awaitTermination()
-
-
-
-