Blacktraffic.AgentBrowserSelenium

Blacktraffic.AgentBrowser. Blacktraffic.AgentBrowserSelenium

Refer to Blacktraffic.AgentBrowser for methods or fields inherited from automatic destructuring.

Creates a new Selenium browser agent (Firefox) used for scraping tasks and purposes. Requires npm selenium-webdriver.

Note. This shared resource type is currently a beta test, and may not be equivalent to Puppeteer logic, which is recommended for production use.

Constructor:
  • arg0_key=Class.generateRandomID(Blacktraffic.AgentBrowserPuppeteer): string - The key to use for the given browser agent. Used for ID.
  • arg1_options: Object
    • .chrome_binary_path: string
    • .debug_console=false: boolean
    • .debugging_port=0: number
    • .headless=false: boolean
    • .onload: function
    • .user_data_folder: string - Refers to a Chrome profile necessary for spoofing.
    • .connection_attempts_threshold=3: number - The number of connection attempts to use when opening the browser.
    • .log_channel="console": string
Instance:
Methods:
  • captureConsoleToChannel(arg0_tab_key:Object|string, arg1_channel_key:string)
  • close() | Blacktraffic.AgentBrowserSelenium
  • closeTab(arg0_tab_key:Object|string) | Blacktraffic.AgentBrowserSelenium
  • closeUserTabs() | Blacktraffic.AgentBrowserSelenium
  • focusTab(arg0_tab_key:Object|string) | Object
  • getElement(arg0_tab_key:Object|string, arg1_selector:string, arg2_options:Object) | HTMLElement
  • getTab(arg0_tab_key:Object|string) | Object
  • getTabs() | Array<Object>
  • injectScript(arg0_tab_key:Object|string, arg1_function:function, arg2_options:Object) | Object
  • injectScriptOnload(arg0_tab_key:Object|string, arg1_function:function, arg2_options:Object) | Object
  • open() | Blacktraffic.AgentBrowserSelenium
  • openTab(arg0_tab_key:Object|string, arg1_url:string) | Object
  • reloadTab(arg0_tab_key:Object|string) | Object
  • remove()
  • tabExists(arg0_tab_key:Object|string, arg1_options:Object)
  • updateLogChannel(arg0_channel_key:string)
  • waitForStableContent(arg0_tab_key:Object|string, arg1_selector:string, arg2_interval=3000:number) | boolean
Static Fields:

Constructor

new Blacktraffic.AgentBrowserSelenium()

Source:

Extends

Members

Methods

(async) captureConsoleToChannel()

Captures the current tab's console and feeds it into a log.Channel.

  • Method of: Blacktraffic.AgentBrowserSelenium
Source:

(async) close() → {Promise.<Blacktraffic.AgentBrowser.AgentBrowserSelenium>}

Closes the browser currently mounted to the AgentBrowser.

  • Method of: Blacktraffic.AgentBrowserSelenium
Source:
Returns:
Type:
Promise.<Blacktraffic.AgentBrowser.AgentBrowserSelenium>

(async) closeTab(arg0_tab_key) → {Promise.<Blacktraffic.AgentBrowser.AgentBrowserSelenium>}

Closes the tab specified.

  • Method of: Blacktraffic.AgentBrowserSelenium
Source:
Parameters:
Name Type Description
arg0_tab_key Object | string
Returns:
Type:
Promise.<Blacktraffic.AgentBrowser.AgentBrowserSelenium>

(async) closeUserTabs() → {Promise.<Blacktraffic.AgentBrowser.AgentBrowserSelenium>}

Closes all user tabs from the current browser.

  • Method of: Blacktraffic.AgentBrowserSelenium
Source:
Returns:
Type:
Promise.<Blacktraffic.AgentBrowser.AgentBrowserSelenium>

(async) focusTab(arg0_tab_key) → {Promise.<(Object|undefined)>}

Focuses the specified tab.

  • Method of: Blacktraffic.AgentBrowserSelenium
Source:
Parameters:
Name Type Description
arg0_tab_key string
Returns:
Type:
Promise.<(Object|undefined)>

(async) getElement(arg0_tab_key, arg1_selector, arg2_optionsopt) → {Promise.<HTMLElement>}

Fetches a specific element handle using CSS selectors.

  • Method of: Blacktraffic.AgentBrowserSelenium
Source:
Parameters:
Name Type Attributes Description
arg0_tab_key Object | string
arg1_selector string
arg2_options Object <optional>
Name Type Attributes Default Description
timeout number <optional>
10000
Returns:
Type:
Promise.<HTMLElement>

getTab(arg0_tab_key) → {Object}

Returns a tab object based on its key.

  • Method of: Blacktraffic.AgentBrowserSelenium
Source:
Parameters:
Name Type Description
arg0_tab_key Object | string
Returns:
Type:
Object

(async) getTabs() → {Promise.<Array.<Object>>}

Returns all tabs in the current browser.

  • Method of: Blacktraffic.AgentBrowserSelenium
Source:
Returns:
Type:
Promise.<Array.<Object>>

(async) injectScript(arg0_tab_key, arg1_function, arg2_optionsopt) → {Promise.<Object>}

Injects a script within the current tab. Note. Contexts are fully isolated when passing a function.

  • Method of: Blacktraffic.AgentBrowserSelenium
Source:
Parameters:
Name Type Attributes Description
arg0_tab_key
arg1_function function
arg2_options Object <optional>
Name Type Attributes Description
options Object <optional>

Any options to pass down to the local function.

Returns:
Type:
Promise.<Object>

(async) injectScriptOnload(arg0_tab_key, arg1_function, arg2_optionsopt) → {Promise.<Object>}

Registers an onload script for future page visits using the mounted tab. Note. Contexts are fully isolated when passing a function.

  • Method of: Blacktraffic.AgentBrowserSelenium
Source:
Parameters:
Name Type Attributes Description
arg0_tab_key Object | string
arg1_function function
arg2_options Object <optional>
Name Type Attributes Description
options Object <optional>

Any options to pass down to the local function.

url string <optional>
Returns:
Type:
Promise.<Object>

(async) open() → {Promise.<Blacktraffic.AgentBrowserSelenium>}

Initialises a Firefox instance and connects Selenium.

  • Method of: Blacktraffic.AgentBrowserSelenium
Source:
Returns:
Type:
Promise.<Blacktraffic.AgentBrowserSelenium>

(async) openTab(arg0_tab_keyopt, arg1_url) → {Promise.<Object>}

Opens a tab at the corresponding URL. Corresponding URLs are optional.

  • Method of: Blacktraffic.AgentBrowserSelenium
Source:
Parameters:
Name Type Attributes Default Description
arg0_tab_key string <optional>
Object.generateRandomID(this.tab_obj)
arg1_url string
Returns:
Type:
Promise.<Object>

(async) reloadTab(arg0_tab_key) → {Promise.<Object>}

Reloads the given tab.

  • Method of: Blacktraffic.AgentBrowserSelenium
Source:
Parameters:
Name Type Description
arg0_tab_key string
Returns:
Type:
Promise.<Object>

(async) remove()

Removes the current Blacktraffic.AgentBrowser.

  • Method of: Blacktraffic.AgentBrowserSelenium
Source:

(async) tabExists(arg0_tab_key, arg1_optionsopt) → {Promise.<boolean>}

Checks if a given tab exists.

  • Method of: Blacktraffic.AgentBrowserSelenium
Source:
Parameters:
Name Type Attributes Description
arg0_tab_key Object | string
arg1_options Object <optional>
Name Type Attributes Default Description
strict boolean <optional>
false

Whether to also ensure the current tab is connected.

Returns:
Type:
Promise.<boolean>

updateLogChannel(arg0_channel_key)

Updates the default logging channel for the current agent.

  • Method of: Blacktraffic.AgentBrowserSelenium
Source:
Parameters:
Name Type Description
arg0_channel_key string

(async) waitForStableSelector(arg0_tab_key, arg1_selector, arg2_intervalopt)

Waits for content to stop changing within a selector.

  • Method of: Blacktraffic.AgentBrowserSelenium
Source:
Parameters:
Name Type Attributes Default Description
arg0_tab_key Object | string

The given tab key.

arg1_selector string
arg2_interval number <optional>
3000