butterbee/browser
The browser module contains the Browser type and functions to create and configure browsers.
Usually you will not need to use this module directly, as it is usually derived
from the configuration in the gleam.toml file. But you can pass it as a type using
the driver.new_with_config
function.
Types
The Browser type contains all the information needed to run a browser.
pub type Browser {
Browser(
browser_type: browser.BrowserType,
cmd: option.Option(#(String, List(String))),
request: option.Option(request.Request(String)),
profile_name: option.Option(String),
profile_dir: option.Option(String),
)
}
Constructors
-
Browser( browser_type: browser.BrowserType, cmd: option.Option(#(String, List(String))), request: option.Option(request.Request(String)), profile_name: option.Option(String), profile_dir: option.Option(String), )Arguments
- browser_type
-
The type of browser to run.
- cmd
-
The command to run the browser including the flags.
- request
-
The url to use to start the browser.
- profile_name
-
The name of the profile to use for the browser.
- profile_dir
-
The directory where the profile is located.
Values
pub fn get_request(
port: Int,
host: String,
) -> request.Request(String)
pub fn new(browser_to_run: browser.BrowserType) -> Browser
pub fn new_port() -> Result(Int, @internal PortError)
Returns a free port to use for a webdriver session
pub fn new_profile(
data_dir: String,
) -> Result(#(String, String), simplifile.FileError)
Create a new profile directory Returns the name of the profile
pub fn with_request(
browser: Browser,
request: request.Request(String),
) -> Browser