-
- All Implemented Interfaces:
-
ai.platon.pulsar.crawl.fetch.driver.WebDriver,java.io.Closeable,java.lang.AutoCloseable,kotlin.Comparable
public final class ChromeDevtoolsDriver extends AbstractWebDriver
-
-
Field Summary
Fields Modifier and Type Field Description private final BrowserTypebrowserTypeprivate final IntegeropenSequenceprivate final DurationchromeTabTimeoutprivate final StringuserAgentprivate final BooleanisSPAprivate final BooleanenableUrlBlockingprivate final List<String>blockingUrlsprivate InstantlastActiveTimeprivate final BooleanisGoneprivate final BooleanisActiveprivate final StringtabIdprivate final RemoteDevToolsimplementationprivate final StringsessionIdprivate final ChromeDevtoolsBrowserbrowserprivate final BrowserInstanceIdbrowserIdprivate final Function1<String, Long>delayPolicyprivate final Integeridprivate DurationidleTimeoutprivate final BooleanisCanceledprivate final BooleanisCrashedprivate final BooleanisFreeprivate final BooleanisIdleprivate final BooleanisMockedPageSourceprivate final BooleanisNotWorkingprivate final BooleanisQuitprivate final BooleanisRetiredprivate final BooleanisWorkingprivate final Stringnameprivate NavigateEntrynavigateEntryprivate final List<NavigateEntry>navigateHistoryprivate final AtomicReference<WebDriver.Status>statusprivate final BooleansupportJavascriptprivate DurationwaitForTimeout
-
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, clickNthAnchor, compareTo, equals, evaluateSilently, firstAttr, firstText, free, hashCode, loadResource, navigateTo, newSession, outerHTML, retire, scrollDown, scrollToBottom, scrollToMiddle, scrollToTop, scrollUp, startWork, waitForNavigation, waitForNavigation, waitForSelector, waitForSelector -
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()
-
getChromeTabTimeout
final Duration getChromeTabTimeout()
-
getUserAgent
final String getUserAgent()
-
getEnableUrlBlocking
final Boolean getEnableUrlBlocking()
-
getBlockingUrls
final List<String> getBlockingUrls()
-
getLastActiveTime
Instant getLastActiveTime()
-
setLastActiveTime
Unit setLastActiveTime(Instant lastActiveTime)
-
getIsActive
final Boolean getIsActive()
-
getImplementation
final RemoteDevTools getImplementation()
-
getSessionId
String getSessionId()
-
getBrowser
ChromeDevtoolsBrowser getBrowser()
-
getBrowserId
BrowserInstanceId getBrowserId()
-
getDelayPolicy
Function1<String, Long> getDelayPolicy()
-
getIdleTimeout
Duration getIdleTimeout()
-
setIdleTimeout
Unit setIdleTimeout(Duration idleTimeout)
-
getIsCanceled
Boolean getIsCanceled()
-
getIsCrashed
Boolean getIsCrashed()
-
getIsMockedPageSource
Boolean getIsMockedPageSource()
-
getIsNotWorking
final Boolean getIsNotWorking()
-
getIsRetired
Boolean getIsRetired()
-
getIsWorking
Boolean getIsWorking()
-
getNavigateEntry
NavigateEntry getNavigateEntry()
-
setNavigateEntry
Unit setNavigateEntry(NavigateEntry navigateEntry)
-
getNavigateHistory
List<NavigateEntry> getNavigateHistory()
-
getStatus
AtomicReference<WebDriver.Status> getStatus()
-
getSupportJavascript
Boolean getSupportJavascript()
-
getWaitForTimeout
Duration getWaitForTimeout()
-
setWaitForTimeout
Unit setWaitForTimeout(Duration waitForTimeout)
-
addInitScript
Unit addInitScript(String script)
-
addBlockedURLs
Unit addBlockedURLs(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()
-
stopLoading
Unit stopLoading()
Force the page stop all navigations and pending resource fetches.
-
evaluate
Object evaluate(String expression)
Evaluate a javascript expression in the browser. The expression should be a single line.
-
currentUrl
String currentUrl()
-
waitForSelector
Long waitForSelector(String selector, Duration timeout)
-
waitForNavigation
Long waitForNavigation(Duration timeout)
-
moveMouseTo
Unit moveMouseTo(Double x, Double y)
-
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
-
clickMatches
Unit clickMatches(String selector, String pattern, Integer 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()
-
-
-
-