Class WebDriverFetcherConfig
java.lang.Object
com.norconex.crawler.core.fetch.BaseFetcherConfig
com.norconex.crawler.web.fetch.impl.webdriver.WebDriverFetcherConfig
Configuration for WebDriverFetcher.
- Since:
- 3.0.0
- See Also:
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanbooleanOptional command-line arguments supported by some web driver or browser.The browser used for crawling.A maximum duration at which we restart the browser.intA maximum number of navigations at which we restart the browser.Local path to browser executable ornullto attempt automatic browser path detection.Gets optional capabilities (configuration options) for the web driver.@NonNull DurationAmount of time between each check for unused browser instances and closing them.Local path to driver executable ornullto attempt automatic detection of the driver path.Optional JavaScript code to be run the moment a page is requested.Optionally setup an HTTP proxy that allows to set and capture HTTP headers.Web driver max wait time for an element to appear.Optional JavaScript code to be run after we are done waiting for a page.Web driver max wait time for a page to load.URL of a remote WebDriver cluster.When configured, takes screenshots of each web pages.Web driver max wait time for a scripts to execute.Makes the current thread sleep for the specified duration, to give the web driver enough time to load the page.Reference to an element to wait for.Max wait time for an element to show up in browser before returning.The type of reference to use when waiting for an element.Optionally set the browser window dimensions.inthashCode()booleanExperimental feature where the selectedWebDriverBrowserwill be used to configure and use HtmlUnit WebDriver as a wrapper instead of directly using the browser WebDriver.setBrowser(WebDriverBrowser browser) The browser used for crawling.setBrowserMaxAge(Duration browserMaxAge) A maximum duration at which we restart the browser.setBrowserMaxNavigations(int browserMaxNavigations) A maximum number of navigations at which we restart the browser.setBrowserPath(Path browserPath) Local path to browser executable ornullto attempt automatic browser path detection.setCapabilities(Map<String, String> capabilities) Sets optional capabilities (configuration options) for the web driver.setCleanupInterval(@NonNull Duration cleanupInterval) Amount of time between each check for unused browser instances and closing them.setDriverPath(Path driverPath) Local path to driver executable ornullto attempt automatic detection of the driver path.setEarlyPageScript(String earlyPageScript) Optional JavaScript code to be run the moment a page is requested.setHttpSniffer(HttpSniffer httpSniffer) Optionally setup an HTTP proxy that allows to set and capture HTTP headers.setImplicitlyWait(Duration implicitlyWait) Web driver max wait time for an element to appear.setLatePageScript(String latePageScript) Optional JavaScript code to be run after we are done waiting for a page.setPageLoadTimeout(Duration pageLoadTimeout) Web driver max wait time for a page to load.setRemoteURL(URL remoteURL) URL of a remote WebDriver cluster.setScreenshotHandler(WebDriverScreenshotHandler screenshotHandler) When configured, takes screenshots of each web pages.setScriptTimeout(Duration scriptTimeout) Web driver max wait time for a scripts to execute.setThreadWait(Duration threadWait) Makes the current thread sleep for the specified duration, to give the web driver enough time to load the page.setUseHtmlUnit(boolean useHtmlUnit) Experimental feature where the selectedWebDriverBrowserwill be used to configure and use HtmlUnit WebDriver as a wrapper instead of directly using the browser WebDriver.setWaitForElementSelector(String waitForElementSelector) Reference to an element to wait for.setWaitForElementTimeout(Duration waitForElementTimeout) Max wait time for an element to show up in browser before returning.setWaitForElementType(WebDriverFetcherConfig.WaitElementType waitForElementType) The type of reference to use when waiting for an element.setWindowSize(Dimension windowSize) Optionally set the browser window dimensions.toString()Methods inherited from class com.norconex.crawler.core.fetch.BaseFetcherConfig
getReferenceFilters, setReferenceFilters
-
Constructor Details
-
WebDriverFetcherConfig
public WebDriverFetcherConfig()
-
-
Method Details
-
getCapabilities
Gets optional capabilities (configuration options) for the web driver. Many are specific to each browser or web driver. Refer to vendor documentation.- Returns:
- capabilities
-
setCapabilities
Sets optional capabilities (configuration options) for the web driver. Many are specific to each browser or web driver. Refer to vendor documentation.- Parameters:
capabilities- web driver capabilities- Returns:
- this
-
getBrowser
The browser used for crawling. Also defines which WebDriver to use. Default is Firefox. -
getDriverPath
Local path to driver executable ornullto attempt automatic detection of the driver path. See web driver vendor documentation for the location facilitating detection. UsesetRemoteURL(URL)instead when using a remote web driver cluster. -
getBrowserPath
Local path to browser executable ornullto attempt automatic browser path detection. See browser vendor documentation for the expected browser installed location. UsesetRemoteURL(URL)instead when using a remote web driver cluster. -
getRemoteURL
URL of a remote WebDriver cluster. Alternative to using a local browser and local web driver. -
isUseHtmlUnit
public boolean isUseHtmlUnit()Experimental feature where the selectedWebDriverBrowserwill be used to configure and use HtmlUnit WebDriver as a wrapper instead of directly using the browser WebDriver. Not all browsers are supported by HtmlUnit (Chrome, Firefox, and Edge are, as of this writing). -
getHttpSniffer
Optionally setup an HTTP proxy that allows to set and capture HTTP headers. For advanced use only. -
getScreenshotHandler
When configured, takes screenshots of each web pages. -
getArguments
Optional command-line arguments supported by some web driver or browser. -
getWindowSize
Optionally set the browser window dimensions. E.g., 640x480. -
getEarlyPageScript
Optional JavaScript code to be run the moment a page is requested. -
getLatePageScript
Optional JavaScript code to be run after we are done waiting for a page. -
getPageLoadTimeout
Web driver max wait time for a page to load. -
getImplicitlyWait
Web driver max wait time for an element to appear. SeegetWaitForElementSelector(). -
getScriptTimeout
Web driver max wait time for a scripts to execute. -
getThreadWait
Makes the current thread sleep for the specified duration, to give the web driver enough time to load the page. Sometimes necessary for some web driver implementations when preferable options fail. -
getWaitForElementType
The type of reference to use when waiting for an element. -
getWaitForElementSelector
Reference to an element to wait for. The nature of the reference itself is defined bygetWaitForElementType(). -
getWaitForElementTimeout
Max wait time for an element to show up in browser before returning. Default 'type' is 'tagName'. -
getBrowserMaxAge
A maximum duration at which we restart the browser. Applies to individual browser instances, typically one per crawl threads. After a while, browsers can accumulate a lot of data in memory and may start performing poorly or cause other issues. Restarting may help. Default isnull(no restart) -
getCleanupInterval
Amount of time between each check for unused browser instances and closing them. Defaults to 10 seconds. Cannot benull. -
setBrowser
The browser used for crawling. Also defines which WebDriver to use. Default is Firefox.- Returns:
this.
-
setDriverPath
Local path to driver executable ornullto attempt automatic detection of the driver path. See web driver vendor documentation for the location facilitating detection. UsesetRemoteURL(URL)instead when using a remote web driver cluster.- Returns:
this.
-
setBrowserPath
Local path to browser executable ornullto attempt automatic browser path detection. See browser vendor documentation for the expected browser installed location. UsesetRemoteURL(URL)instead when using a remote web driver cluster.- Returns:
this.
-
setRemoteURL
URL of a remote WebDriver cluster. Alternative to using a local browser and local web driver.- Returns:
this.
-
setUseHtmlUnit
Experimental feature where the selectedWebDriverBrowserwill be used to configure and use HtmlUnit WebDriver as a wrapper instead of directly using the browser WebDriver. Not all browsers are supported by HtmlUnit (Chrome, Firefox, and Edge are, as of this writing).- Returns:
this.
-
setHttpSniffer
Optionally setup an HTTP proxy that allows to set and capture HTTP headers. For advanced use only.- Returns:
this.
-
setScreenshotHandler
When configured, takes screenshots of each web pages.- Returns:
this.
-
setWindowSize
Optionally set the browser window dimensions. E.g., 640x480.- Returns:
this.
-
setEarlyPageScript
Optional JavaScript code to be run the moment a page is requested.- Returns:
this.
-
setLatePageScript
Optional JavaScript code to be run after we are done waiting for a page.- Returns:
this.
-
setPageLoadTimeout
Web driver max wait time for a page to load.- Returns:
this.
-
setImplicitlyWait
Web driver max wait time for an element to appear. SeegetWaitForElementSelector().- Returns:
this.
-
setScriptTimeout
Web driver max wait time for a scripts to execute.- Returns:
this.
-
setThreadWait
Makes the current thread sleep for the specified duration, to give the web driver enough time to load the page. Sometimes necessary for some web driver implementations when preferable options fail.- Returns:
this.
-
setWaitForElementType
public WebDriverFetcherConfig setWaitForElementType(WebDriverFetcherConfig.WaitElementType waitForElementType) The type of reference to use when waiting for an element.- Returns:
this.
-
setWaitForElementSelector
Reference to an element to wait for. The nature of the reference itself is defined bygetWaitForElementType().- Returns:
this.
-
setWaitForElementTimeout
Max wait time for an element to show up in browser before returning. Default 'type' is 'tagName'.- Returns:
this.
-
setBrowserMaxAge
A maximum duration at which we restart the browser. Applies to individual browser instances, typically one per crawl threads. After a while, browsers can accumulate a lot of data in memory and may start performing poorly or cause other issues. Restarting may help. Default isnull(no restart)- Returns:
this.
-
setCleanupInterval
Amount of time between each check for unused browser instances and closing them. Defaults to 10 seconds. Cannot benull.- Returns:
this.
-
equals
- Overrides:
equalsin classBaseFetcherConfig
-
canEqual
- Overrides:
canEqualin classBaseFetcherConfig
-
hashCode
public int hashCode()- Overrides:
hashCodein classBaseFetcherConfig
-
toString
- Overrides:
toStringin classBaseFetcherConfig
-