Class MockWebDriver
-
- 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 MockWebDriver extends AbstractWebDriver
-
-
Field Summary
Fields Modifier and Type Field Description private final StringmockPageSourceprivate final WebDriverrealDriverprivate final BrowserTypebrowserTypeprivate final BooleansupportJavascriptprivate final BooleanisMockedPageSourceprivate final StringsessionIdprivate final Browserbrowserprivate final Map<String, Object>dataprivate final Function1<String, Long>delayPolicyprivate final Integeridprivate DurationidleTimeoutprivate final BooleanisCanceledprivate final BooleanisCrashedprivate final BooleanisFreeprivate final BooleanisIdleprivate final BooleanisInitprivate final BooleanisQuitprivate final BooleanisReadyprivate BooleanisRecoveredprivate final BooleanisRetiredprivate BooleanisReusedprivate final BooleanisWorkingprivate InstantlastActiveTimeprivate final List<Map<String, String>>mainRequestCookiesprivate final Map<String, Object>mainRequestHeadersprivate final Map<String, Object>mainResponseHeadersprivate final IntegermainResponseStatusprivate final StringmainResponseStatusTextprivate final Stringnameprivate NavigateEntrynavigateEntryprivate final NavigateHistorynavigateHistoryprivate final AtomicReference<WebDriver.State>stateprivate DurationwaitForElementTimeout
-
Constructor Summary
Constructors Constructor Description MockWebDriver(MockBrowser browser, Function0<WebDriver> backupDriverCreator)
-
Method Summary
-
Methods inherited from class ai.platon.pulsar.crawl.fetch.driver.AbstractWebDriver
allAttrs, allTexts, cancel, check, clickNthAnchor, compareTo, equals, evaluateSilently, firstAttr, firstText, free, getBrowser, getData, getDelayPolicy, getId, getIdleTimeout, getLastActiveTime, getMainRequestCookies, getMainRequestHeaders, getMainResponseHeaders, getMainResponseStatus, getMainResponseStatusText, getName, getNavigateEntry, getNavigateHistory, getState, getWaitForElementTimeout, hashCode, isCanceled, isChecked, isCrashed, isFree, isInit, isQuit, isReady, isRecovered, isRetired, isReused, isWorking, jvm, loadJsoupResource, loadResource, newJsoupSession, newSession, outerHTML, outerHTML, retire, scrollDown, scrollToBottom, scrollToMiddle, scrollToTop, scrollUp, setIdleTimeout, setLastActiveTime, setNavigateEntry, setRecovered, setReused, setWaitForElementTimeout, startWork, uncheck, waitForNavigation, waitForNavigation, waitForSelector, waitForSelector -
Methods inherited from class ai.platon.pulsar.crawl.fetch.driver.WebDriver
isHidden, isIdle, stopLoading, visible -
Methods inherited from class ai.platon.pulsar.crawl.fetch.driver.AbstractJvmWebDriver
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.JvmWebDriver
clickAsync, clickMatchesAsync -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
MockWebDriver
MockWebDriver(MockBrowser browser, Function0<WebDriver> backupDriverCreator)
-
-
Method Detail
-
getMockPageSource
final String getMockPageSource()
-
getRealDriver
final WebDriver getRealDriver()
-
getBrowserType
BrowserType getBrowserType()
-
getSupportJavascript
Boolean getSupportJavascript()
-
isMockedPageSource
Boolean isMockedPageSource()
-
getSessionId
String getSessionId()
-
addInitScript
Unit addInitScript(String script)
-
addBlockedURLs
Unit addBlockedURLs(List<String> urls)
-
addProbabilityBlockedURLs
Unit addProbabilityBlockedURLs(List<String> urls)
-
navigateTo
Unit navigateTo(NavigateEntry entry)
-
navigateTo
Unit navigateTo(String url)
-
waitForSelector
Long waitForSelector(String selector, Duration timeout)
-
waitForNavigation
Long waitForNavigation(Duration timeout)
-
waitForPage
WebDriver waitForPage(String url, Duration timeout)
-
setTimeouts
Unit setTimeouts(BrowserSettings browserSettings)
-
mainRequestHeaders
@Deprecated(message = "Getter is available", replaceWith = @ReplaceWith(imports = {}, expression = "mainRequestHeaders")) Map<String, Object> mainRequestHeaders()
-
mainRequestCookies
@Deprecated(message = "Getter is available", replaceWith = @ReplaceWith(imports = {}, expression = "mainRequestCookies")) List<Map<String, String>> mainRequestCookies()
-
getCookies
List<Map<String, String>> getCookies()
-
clearBrowserCookies
Unit clearBrowserCookies()
-
deleteCookies
Unit deleteCookies(String name)
-
captureScreenshot
String captureScreenshot(String selector)
-
captureScreenshot
String captureScreenshot(RectD rect)
-
evaluateDetail
JsEvaluation evaluateDetail(String expression)
-
currentUrl
String currentUrl()
-
pageSource
String pageSource()
-
bringToFront
Unit bringToFront()
-
clickTextMatches
Unit clickTextMatches(String selector, String pattern, Integer count)
-
clickMatches
@Deprecated(message = "Inappropriate name", replaceWith = @ReplaceWith(imports = {}, expression = "clickTextMatches(selector, pattern, count")) Unit clickMatches(String selector, String pattern, Integer count)
-
moveMouseTo
Unit moveMouseTo(Double x, Double y)
-
moveMouseTo
Unit moveMouseTo(String selector, Integer deltaX, Integer deltaY)
-
dragAndDrop
Unit dragAndDrop(String selector, Integer deltaX, Integer deltaY)
-
clickablePoint
PointD clickablePoint(String selector)
-
boundingBox
RectD boundingBox(String selector)
-
awaitTermination
Unit awaitTermination()
-
-
-
-