Selenium Wrapper

The darc.selenium module wraps around the selenium module, and provides some simple interface for the darc project.

darc.selenium.get_capabilities(type='null')[source]

Generate desied capabilities.

Parameters

type (str) – Proxy type for capabilities.

Return type

Dict[str, str]

Returns

The desied capabilities for the web driver WebDriver.

Raises

UnsupportedProxy – If the proxy type is NOT null, tor or i2p.

See also

  • darc.proxy.tor.TOR_SELENIUM_PROXY

  • darc.proxy.i2p.I2P_SELENIUM_PROXY

darc.selenium.get_options(type='null')[source]

Generate options.

Parameters

type (str) – Proxy type for options.

Returns

The options for the web driver

WebDriver.

Return type

selenium.webdriver.chrome.options.Options

Raises

Important

The function raises UnsupportedPlatform in cases where BINARY_LOCATION is None.

Please provide CHROME_BINARY_LOCATION when running darc in loader mode on non macOS and/or Linux systems.

See also

  • darc.proxy.tor.TOR_PORT

  • darc.proxy.i2p.I2P_PORT

References

darc.selenium.i2p_driver()[source]

I2P (.i2p) driver.

Returns

The web driver object with I2P proxy settings.

Return type

selenium.webdriver.chrome.webdriver.WebDriver

darc.selenium.null_driver()[source]

No proxy driver.

Returns

The web driver object with no proxy settings.

Return type

selenium.webdriver.chrome.webdriver.WebDriver

darc.selenium.request_driver(link)[source]

Get selenium driver.

Parameters

link (Link) – Link requesting for WebDriver.

Returns

The web driver object with corresponding proxy settings.

Return type

selenium.webdriver.chrome.webdriver.WebDriver

Raises

UnsupportedLink – If the proxy type of link if not specified in the LINK_MAP.

See also

  • darc.proxy.LINK_MAP

darc.selenium.tor_driver()[source]

Tor (.onion) driver.

Returns

The web driver object with Tor proxy settings.

Return type

selenium.webdriver.chrome.webdriver.WebDriver

darc.selenium.BINARY_LOCATION: Optional[str]

Path to Google Chrome binary location.

Default

google-chrome

Environ

CHROME_BINARY_LOCATION