Learn R Programming

selenium (version 0.1.4)

wait_for_server: Is a selenium server instance running?

Description

wait_for_server() takes a server process returned by selenium_server() and waits for it to respond to status requests. If it doesn't, then an error is thrown detailing any errors in the response and any error messages from the server.

selenium_server_available() returns TRUE if a Selenium server is running on a given port and host. wait_for_selenium_available() waits for the Selenium server to become available for a given time, throwing an error if one does not. It is similar to wait_for_server() except that it works with servers not created by selenium.

get_server_status(), when given a port and host, figures out whether a Selenium server instance is running, and if so, returns its status. This is used by selenium_server_available() to figure out if the server is running.

Usage

wait_for_server(
  server,
  port = 4444L,
  host = "localhost",
  max_time = 60,
  error = TRUE,
  verbose = FALSE,
  timeout = 20
)

selenium_server_available( port = 4444L, host = "localhost", verbose = FALSE, timeout = 20 )

wait_for_selenium_available( max_time = 60, port = 4444L, host = "localhost", error = TRUE, verbose = FALSE, timeout = 20 )

get_server_status( port = 4444L, host = "localhost", verbose = FALSE, timeout = 20 )

Value

wait_for_server() and wait_for_selenium_available() return TRUE if the server is ready to be connected to, and throw an error otherwise.

selenium_server_available() returns TRUE if a Selenium server is running, and FALSE otherwise.

get_server_status() returns a list that can (but may not always) contain the following fields:

  • ready: Whether the server is ready to be connected to. This should always be returned by the server.

  • message: A message about the status of the server.

  • uptime: How long the server has been running.

  • nodes: Information about the slots that the server can take.

Arguments

server

The process object returned by selenium_server().

port

The port that the Selenium server is using, so we can connect to it.

host

The host that the Selenium server is running on. This is usually 'localhost' (i.e. Your own machine).

max_time

The amount of time to wait for the Selenium server to become available.

error

Whether to throw an error if the web request fails after the timeout is exceeded. If not, and we can't connect to a server, FALSE is returned.

verbose

Whether to print information about the web request that is sent.

timeout

How long to wait for a request to recieve a response before throwing an error.

Examples

Run this code
if (FALSE) {
server <- selenium_server()

wait_for_server(server)

get_server_status()

selenium_server_available()

wait_for_selenium_available()
}

Run the code above in your browser using DataLab