Choosing which Chrome-based browser to use

Using a Chrome-based browser that you installed

Chromote will look in specific places for the Chrome web browser, depending on platform. This is done by the chromote:::find_chrome() function.

If you wish to use a different browser from the default, you can set the CHROMOTE_CHROME environment variable, either with Sys.setenv(CHROMOTE_CHROME="/path/to/browser").

library(chromote)
Sys.setenv(CHROMOTE_CHROME = "/Applications/Chromium.app/Contents/MacOS/Chromium")

b <- ChromoteSession$new()
b$view()
b$Page$navigate("https://www.whatismybrowser.com/")

Another way is create a Chromote object and explicitly specify the browser, then spawn ChromoteSessions from it.

m <- Chromote$new(
  browser = Chrome$new(path = "/Applications/Chromium.app/Contents/MacOS/Chromium")
)

# Spawn a ChromoteSession from the Chromote object
b <- m$new_session()
b$Page$navigate("https://www.whatismybrowser.com/")

Yet another way is to create a Chromote object with a specified browser, then set it as the default Chromote object.

m <- Chromote$new(
  browser = Chrome$new(path = "/Applications/Chromium.app/Contents/MacOS/Chromium")
)

# Set this Chromote object as the default. Then any
# ChromoteSession$new() will be spawned from it.
set_default_chromote_object(m)
b <- ChromoteSession$new()
b$view()
b$Page$navigate("https://www.whatismybrowser.com/")