Class PulsarSettings
-
- All Implemented Interfaces:
public class PulsarSettingsThe PulsarSettings class defines a convenient interface to control the behavior of PulsarRPA.
For example, to run multiple temporary browsers in headless mode, which is usually used in the spider scenario, you can use the following code:
PulsarSettings .headless() .maxBrowsers(4) .maxOpenTabs(12) .enableUrlBlocking()The above code will:
Run the browser in headless mode
Set the number of privacy contexts to 4
Set the max number of open tabs in each browser context to 12
Enable url blocking
If you want to run your system's default browser in GUI mode, and interact with the webpage, you can use the following code:
PulsarSettings.withSystemDefaultBrowser().withGUI().withSPA()The above code will:
Use the system's default browser
Run the browser in GUI mode
Set the system to work with single page application
-
-
Constructor Summary
Constructors Constructor Description PulsarSettings()
-
Method Summary
Modifier and Type Method Description final PulsarSettingswithBrowserContextMode(BrowserContextMode contextMode)final PulsarSettingswithBrowserContextMode(BrowserContextMode contextMode, BrowserType browserType)final PulsarSettingswithBrowser(BrowserType browserType)final PulsarSettingswithSystemDefaultBrowser()Use the system's default Chrome browser, so PulsarRPA visits websites just like you do. final PulsarSettingswithSystemDefaultBrowser(BrowserType browserType)Use the system's default browser with the given type, so PulsarRPA visits websites just like you do. final PulsarSettingswithDefaultBrowser()Use the default browser which has an isolated profile and user data directory. final PulsarSettingswithDefaultBrowser(BrowserType browserType)Use the default browser which has an isolated profile and user data directory. final PulsarSettingswithPrototypeBrowser()Use Google Chrome with the prototype environment. final PulsarSettingswithPrototypeBrowser(BrowserType browserType)Use the specified browser with the prototype environment. final PulsarSettingswithSequentialBrowsers()Use sequential browsers that inherits the prototype browser’s environment. final PulsarSettingswithSequentialBrowsers(BrowserType browserType)Use sequential browsers that inherits the prototype browser’s environment. final PulsarSettingswithSequentialBrowsers(BrowserType browserType, Integer maxAgents)Use sequential browsers that inherits from the prototype browser’s environment. final PulsarSettingswithTemporaryBrowser()Use a temporary browser that inherits from the prototype browser’s environment. final PulsarSettingswithTemporaryBrowser(BrowserType browserType)Use a temporary browser that inherits from the prototype browser’s environment. final PulsarSettingswithGUI()Launch the browser in GUI mode. final PulsarSettingsheaded()Launch the browser in GUI mode. final PulsarSettingsheadless()Launch the browser in headless mode. final PulsarSettingssupervised()Launch the browser in supervised mode. final PulsarSettingsmaxBrowsers(Integer n)Set the max number of agents final PulsarSettingsmaxBrowserContexts(Integer n)Set the max number of agents final PulsarSettingsmaxOpenTabs(Integer n)Set the max number to open tabs in each browser context final PulsarSettingswithSPA()Tell the system to work with single page application. final PulsarSettingswithInteractSettings(InteractSettings settings)Use the specified interact settings to interact with webpages. final PulsarSettingsenableUrlBlocking()Enable url blocking. final PulsarSettingsenableUrlBlocking(Float probability)Enable url blocking with the given probability. final PulsarSettingsdisableUrlBlocking()Disable url blocking. final PulsarSettingsblockImages()Block all images. final PulsarSettingsenableOriginalPageContentAutoExporting()Export all pages automatically once they are fetched. final PulsarSettingsenableOriginalPageContentAutoExporting(Integer limit)Export at most limit pages once they are fetched. final PulsarSettingsdisableOriginalPageContentAutoExporting()Disable original page content exporting. final PulsarSettingswithLLM(String provider, String name, String apiKey)Sets the Large Language Model (LLM) provider for the PulsarRPA settings. final PulsarSettingswithLLMProvider(String provider)Sets the Large Language Model (LLM) provider for the PulsarRPA settings. final PulsarSettingswithLLMName(String name)Sets the Large Language Model (LLM) name for the PulsarRPA settings. final PulsarSettingswithLLMAPIKey(String key)Sets the Large Language Model (LLM) API key for the PulsarRPA settings. -
-
Method Detail
-
withBrowserContextMode
final PulsarSettings withBrowserContextMode(BrowserContextMode contextMode)
-
withBrowserContextMode
final PulsarSettings withBrowserContextMode(BrowserContextMode contextMode, BrowserType browserType)
-
withBrowser
final PulsarSettings withBrowser(BrowserType browserType)
-
withSystemDefaultBrowser
final PulsarSettings withSystemDefaultBrowser()
Use the system's default Chrome browser, so PulsarRPA visits websites just like you do. Any change to the browser will be kept.
-
withSystemDefaultBrowser
final PulsarSettings withSystemDefaultBrowser(BrowserType browserType)
Use the system's default browser with the given type, so PulsarRPA visits websites just like you do. Any change to the browser will be kept.
-
withDefaultBrowser
final PulsarSettings withDefaultBrowser()
Use the default browser which has an isolated profile and user data directory. Any modifications made to the browser will be preserved, including the cookies, history, etc.
-
withDefaultBrowser
final PulsarSettings withDefaultBrowser(BrowserType browserType)
Use the default browser which has an isolated profile and user data directory. Any modifications made to the browser will be preserved, including the cookies, history, etc.
-
withPrototypeBrowser
final PulsarSettings withPrototypeBrowser()
Use Google Chrome with the prototype environment. Any modifications made to the browser will be preserved. Sequential and temporary browsers will inherit the environment from the prototype browser.
-
withPrototypeBrowser
final PulsarSettings withPrototypeBrowser(BrowserType browserType)
Use the specified browser with the prototype environment. Any modifications made to the browser will be preserved. Sequential and temporary browsers will inherit the environment from the prototype browser.
-
withSequentialBrowsers
final PulsarSettings withSequentialBrowsers()
Use sequential browsers that inherits the prototype browser’s environment. The sequential browsers are permanent unless the context directories are deleted manually.
- Returns:
the PulsarSettings itself
-
withSequentialBrowsers
final PulsarSettings withSequentialBrowsers(BrowserType browserType)
Use sequential browsers that inherits the prototype browser’s environment. The sequential browsers are permanent unless the context directories are deleted manually.
- Returns:
the PulsarSettings itself
-
withSequentialBrowsers
final PulsarSettings withSequentialBrowsers(BrowserType browserType, Integer maxAgents)
Use sequential browsers that inherits from the prototype browser’s environment. The sequential browsers are permanent unless the context directories are deleted manually.
- Parameters:
maxAgents- The maximum number of sequential privacy agents, the active privacy contexts is chosen from them.- Returns:
the PulsarSettings itself
-
withTemporaryBrowser
final PulsarSettings withTemporaryBrowser()
Use a temporary browser that inherits from the prototype browser’s environment. The temporary browser will not be used again after it is shut down.
-
withTemporaryBrowser
final PulsarSettings withTemporaryBrowser(BrowserType browserType)
Use a temporary browser that inherits from the prototype browser’s environment. The temporary browser will not be used again after it is shut down.
-
withGUI
final PulsarSettings withGUI()
Launch the browser in GUI mode.
-
headed
final PulsarSettings headed()
Launch the browser in GUI mode.
-
headless
final PulsarSettings headless()
Launch the browser in headless mode.
-
supervised
final PulsarSettings supervised()
Launch the browser in supervised mode.
-
maxBrowsers
@Deprecated(message = "Use maxBrowserContexts instead", replaceWith = @ReplaceWith(imports = {}, expression = "maxBrowserContexts(n)")) final PulsarSettings maxBrowsers(Integer n)
Set the max number of agents
-
maxBrowserContexts
final PulsarSettings maxBrowserContexts(Integer n)
Set the max number of agents
-
maxOpenTabs
final PulsarSettings maxOpenTabs(Integer n)
Set the max number to open tabs in each browser context
-
withSPA
final PulsarSettings withSPA()
Tell the system to work with single page application. To collect SPA data, the execution needs to have no timeout limit.
-
withInteractSettings
final PulsarSettings withInteractSettings(InteractSettings settings)
Use the specified interact settings to interact with webpages.
-
enableUrlBlocking
final PulsarSettings enableUrlBlocking()
Enable url blocking. If url blocking is enabled and the blocking rules are set, resources matching the rules will be blocked by the browser.
-
enableUrlBlocking
final PulsarSettings enableUrlBlocking(Float probability)
Enable url blocking with the given probability. The probability must be in 0, 1.
-
disableUrlBlocking
final PulsarSettings disableUrlBlocking()
Disable url blocking. If url blocking is disabled, blocking rules are ignored.
-
blockImages
final PulsarSettings blockImages()
Block all images.
-
enableOriginalPageContentAutoExporting
final PulsarSettings enableOriginalPageContentAutoExporting()
Export all pages automatically once they are fetched.
The export directory is under AppPaths.WEB_CACHE_DIR. A typical export path is:
AppPaths.WEB_CACHE_DIR/default/pulsar_chrome/OK/amazon-com
C:\Users\pereg\AppData\Local\Temp\pulsar-pereg\cache\web\default\pulsar_chrome\OK\amazon-com
-
enableOriginalPageContentAutoExporting
final PulsarSettings enableOriginalPageContentAutoExporting(Integer limit)
Export at most limit pages once they are fetched.
The export directory is under AppPaths.WEB_CACHE_DIR. A typical export path is:
AppPaths.WEB_CACHE_DIR/default/pulsar_chrome/OK/amazon-com
C:\Users\pereg\AppData\Local\Temp\pulsar-pereg\cache\web\default\pulsar_chrome\OK\amazon-com
-
disableOriginalPageContentAutoExporting
final PulsarSettings disableOriginalPageContentAutoExporting()
Disable original page content exporting.
-
withLLM
final PulsarSettings withLLM(String provider, String name, String apiKey)
Sets the Large Language Model (LLM) provider for the PulsarRPA settings.
This function allows specifying the LLM provider to be used. The provider must be a non-null string.
Supported LLM providers include:
<a href='https://www.volcengine.com/docs/82379/1399008'>Volcengine API</a>
<a href='https://api-docs.deepseek.com/'>DeepSeek API</a>
For example, you can use the following code to set the LLM provider:
// use volcengine as the LLM provider PulsarSettings().withLLM("volcengine", "ep-20250218132011-2scs8", apiKey)- Parameters:
provider- The name of the LLM provider to be used.- Returns:
The current instance of PulsarSettings to allow method chaining.
-
withLLMProvider
final PulsarSettings withLLMProvider(String provider)
Sets the Large Language Model (LLM) provider for the PulsarRPA settings.
This function allows specifying the LLM provider to be used. The provider must be a non-null string.
Supported LLM providers include:
<a href='https://www.volcengine.com/docs/82379/1399008'>Volcengine API</a>
<a href='https://api-docs.deepseek.com/'>DeepSeek API</a>
For example, you can use the following code to set the LLM provider:
PulsarSettings() .withLLMProvider("volcengine") // use volcengine as the LLM provider .withLLMName("ep-20250218132011-2scs8") // the LLM name, you should change it to your own .withLLMAPIKey(apiKey) // the LLM api key, you should change it to your own- Parameters:
provider- The name of the LLM provider to be used.- Returns:
The current instance of PulsarSettings to allow method chaining.
-
withLLMName
final PulsarSettings withLLMName(String name)
Sets the Large Language Model (LLM) name for the PulsarRPA settings.
Supported LLM providers include:
<a href='https://www.volcengine.com/docs/82379/1399008'>Volcengine API</a>
<a href='https://api-docs.deepseek.com/'>DeepSeek API</a>
For example, you can use the following code to set the LLM provider:
PulsarSettings() .withLLMProvider("volcengine") // use volcengine as the LLM provider .withLLMName("ep-20250218132011-2scs8") // the LLM name, you should change it to your own .withLLMAPIKey(apiKey) // the LLM api key, you should change it to your own- Parameters:
name- The name of the Large Language Model (LLM) to be set.- Returns:
The current instance of PulsarSettings to allow for method chaining.
-
withLLMAPIKey
final PulsarSettings withLLMAPIKey(String key)
Sets the Large Language Model (LLM) API key for the PulsarRPA settings.
Supported LLM providers include:
<a href='https://www.volcengine.com/docs/82379/1399008'>Volcengine API</a>
<a href='https://api-docs.deepseek.com/'>DeepSeek API</a>
For example, you can use the following code to set the LLM provider:
PulsarSettings() .withLLMProvider("volcengine") // use volcengine as the LLM provider .withLLMName("ep-20250218132011-2scs8") // the LLM name, you should change it to your own .withLLMAPIKey(apiKey) // the LLM api key, you should change it to your own- Parameters:
key- The API key to be set.- Returns:
The current instance of PulsarSettings to allow for method chaining.
-
-
-
-