Wallaby.Chrome (wallaby v0.28.0) View Source
The Chrome driver uses Chromedriver to power Google Chrome and Chromium.
Usage
Start a Wallaby Session using this driver with the following command:
{:ok, session} = Wallaby.start_session()
Configuration
Headless
Chrome will run in headless mode by default. You can disable this behaviour using the following configuration.
This will override the default capabilities and capabilities set with application configuration.
This will not override capabilities passed in directly to Wallaby.start_session/1
.
config :wallaby,
chromedriver: [
headless: false
]
Capabilities
These capabilities will override the default capabilities.
config :wallaby,
chromedriver: [
capabilities: %{
# something
}
]
ChromeDriver binary
If ChromeDriver is not available in your path, you can specify it's location.
config :wallaby,
chromedriver: [
path: "path/to/chrome"
]
Chrome binary
This configures which instance of Google Chrome to use.
This will override the default capabilities and capabilities set with application configuration.
This will not override capabilities passed in directly to Wallaby.start_session/1
.
config :wallaby,
chromedriver: [
binary: "path/to/chrome"
]
Default Capabilities
By default, Chromdriver will use the following capabilities
You can read more about capabilities in the JSON Wire Protocol documentation and the Chromedriver documentation.
%{
javascriptEnabled: false,
loadImages: false,
version: "",
rotatable: false,
takesScreenshot: true,
cssSelectorsEnabled: true,
nativeEvents: false,
platform: "ANY",
unhandledPromptBehavior: "accept",
loggingPrefs: %{
browser: "DEBUG"
},
chromeOptions: %{
args: [
"--no-sandbox",
"window-size=1280,800",
"--disable-gpu",
"--headless",
"--fullscreen",
"--user-agent=Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36"
]
}
}
Notes
This driver requires Chromedriver to be installed in your path.
Link to this section Summary
Types
Options to pass to Wallaby.start_session/1
Functions
Returns a specification to start this module under a supervisor.
Link to this section Types
Specs
start_session_opts() :: {:capabilities, map()} | {:readiness_timeout, timeout()} | {:create_session_fn, (String.t(), map() -> {:ok, %{}})}
Options to pass to Wallaby.start_session/1
Wallaby.start_session(
capabilities: %{chromeOptions: %{args: ["--headless"]}},
create_session_fn: fn url, capabilities ->
WebdriverClient.create_session(url, capabilities)
end
)
:capabilities
- capabilities to pass to chromedriver on session startupcreate_session_fn
- Deprecated and to be removed:readiness_timeout
- milliseconds to wait for chromedriver server to be ready before raising a timeout error. (Default: 5000)
Link to this section Functions
Returns a specification to start this module under a supervisor.
See Supervisor
.