Browse Source

- tested more parameters

- changed some parameter defaults
- tested proxy settings
- modified test harness
master
boB Rudis 7 years ago
parent
commit
8412d14da4
  1. 1
      NAMESPACE
  2. 28
      R/render-har.r
  3. 30
      R/render-html.r
  4. 38
      R/render-jpg.r
  5. 37
      R/render-json.r
  6. 39
      R/render-png.r
  7. 2
      R/splashr-package.R
  8. 2
      man/render_har.Rd
  9. 2
      man/render_html.Rd
  10. 14
      man/render_jpeg.Rd
  11. 8
      man/render_json.Rd
  12. 14
      man/render_png.Rd
  13. 12
      tests/testthat/test-splash.R

1
NAMESPACE

@ -93,6 +93,7 @@ importFrom(clipr,read_clip)
importFrom(curl,curl_unescape)
importFrom(formatR,tidy_source)
importFrom(jsonlite,fromJSON)
importFrom(jsonlite,unbox)
importFrom(lubridate,ymd_hms)
importFrom(openssl,base64_decode)
importFrom(scales,comma)

28
R/render-har.r

@ -14,24 +14,24 @@ render_har <- function(splash_obj = splash_local, url, base_url, response_body=F
forbidden_content_types, viewport="1024x768", images, headers, body,
http_method, save_args, load_args) {
params <- list(url=url, timeout=timeout, wait=wait, viewport=viewport,
params <- list(url=url, timeout=timeout, wait=wait, viewport=jsonlite::unbox(viewport),
response_body=as.numeric(response_body))
if (!missing(base_url)) params$base_url <- base_url
if (!missing(base_url)) params$base_url <- jsonlite::unbox(base_url)
if (!missing(resource_timeout)) params$resource_timeout <- resource_timeout
if (!missing(proxy)) proxy$base_url <- proxy
if (!missing(js)) params$js <- js
if (!missing(js_src)) params$js_src <- js_src
if (!missing(filters)) params$filters <- filters
if (!missing(allowed_domains)) params$allowed_domains <- allowed_domains
if (!missing(allowed_content_types)) params$allowed_content_types <- allowed_content_types
if (!missing(forbidden_content_types)) params$forbidden_content_types <- forbidden_content_types
if (!missing(images)) params$images <- images
if (!missing(proxy)) params$proxy <- jsonlite::unbox(proxy)
if (!missing(js)) params$js <- jsonlite::unbox(js)
if (!missing(js_src)) params$js_src <- jsonlite::unbox(js_src)
if (!missing(filters)) params$filters <- jsonlite::unbox(filters)
if (!missing(allowed_domains)) params$allowed_domains <- jsonlite::unbox(allowed_domains)
if (!missing(allowed_content_types)) params$allowed_content_types <- jsonlite::unbox(allowed_content_types)
if (!missing(forbidden_content_types)) params$forbidden_content_types <- jsonlite::unbox(forbidden_content_types)
if (!missing(images)) params$images <- as.numeric(images)
if (!missing(headers)) params$headers <- headers
if (!missing(body)) params$body <- body
if (!missing(http_method)) params$http_method <- http_method
if (!missing(save_args)) params$save_args <- save_args
if (!missing(load_args)) params$load_args <- load_args
if (!missing(body)) params$body <- jsonlite::unbox(body)
if (!missing(http_method)) params$http_method <- jsonlite::unbox(http_method)
if (!missing(save_args)) params$save_args <- jsonlite::unbox(save_args)
if (!missing(load_args)) params$load_args <- jsonlite::unbox(load_args)
res <- httr::GET(splash_url(splash_obj), path="render.har", encode="json", query=params)

30
R/render-html.r

@ -16,7 +16,7 @@
#' @param allowed_domains Comma-separated list of allowed domain names. If present, Splash won’t load anything neither from domains not in this list nor from subdomains of domains not in this list.
#' @param allowed_content_types Comma-separated list of allowed content types. If present, Splash will abort any request if the response’s content type doesn’t match any of the content types in this list. Wildcards are supported.
#' @param forbidden_content_types Comma-separated list of forbidden content types. If present, Splash will abort any request if the response’s content type matches any of the content types in this list. Wildcards are supported.
#' @param viewport View width and height (in pixels) of the browser viewport to render the web page. Format is “<width>x<height>”, e.g. 800x600. Default value is 1024x768.
#' @param viewport View width and height (in pixels) of the browser viewport to render the web page. Format is “<width>x<height>”, e.g. 800x600. Default value is "full".
#' @param images Whether to download images.
#' @param headers HTTP headers to set for the first outgoing request.
#' @param body Body of HTTP POST request to be sent if method is POST.
@ -35,23 +35,23 @@ render_html <- function(splash_obj = splash_local, url, base_url, timeout=30, re
forbidden_content_types, viewport="1024x768", images, headers, body,
http_method, save_args, load_args, raw_html=FALSE) {
params <- list(url=url, timeout=timeout, wait=wait, viewport=viewport)
params <- list(url=url, timeout=timeout, wait=wait, viewport=jsonlite::unbox(viewport))
if (!missing(base_url)) params$base_url <- base_url
if (!missing(base_url)) params$base_url <- jsonlite::unbox(base_url)
if (!missing(resource_timeout)) params$resource_timeout <- resource_timeout
if (!missing(proxy)) proxy$base_url <- proxy
if (!missing(js)) params$js <- js
if (!missing(js_src)) params$js_src <- js_src
if (!missing(filters)) params$filters <- filters
if (!missing(allowed_domains)) params$allowed_domains <- allowed_domains
if (!missing(allowed_content_types)) params$allowed_content_types <- allowed_content_types
if (!missing(forbidden_content_types)) params$forbidden_content_types <- forbidden_content_types
if (!missing(images)) params$images <- images
if (!missing(proxy)) params$proxy <- jsonlite::unbox(proxy)
if (!missing(js)) params$js <- jsonlite::unbox(js)
if (!missing(js_src)) params$js_src <- jsonlite::unbox(js_src)
if (!missing(filters)) params$filters <- jsonlite::unbox(filters)
if (!missing(allowed_domains)) params$allowed_domains <- jsonlite::unbox(allowed_domains)
if (!missing(allowed_content_types)) params$allowed_content_types <- jsonlite::unbox(allowed_content_types)
if (!missing(forbidden_content_types)) params$forbidden_content_types <- jsonlite::unbox(forbidden_content_types)
if (!missing(images)) params$images <- as.numeric(images)
if (!missing(headers)) params$headers <- headers
if (!missing(body)) params$body <- body
if (!missing(http_method)) params$http_method <- http_method
if (!missing(save_args)) params$save_args <- save_args
if (!missing(load_args)) params$load_args <- load_args
if (!missing(body)) params$body <- jsonlite::unbox(body)
if (!missing(http_method)) params$http_method <- jsonlite::unbox(http_method)
if (!missing(save_args)) params$save_args <- jsonlite::unbox(save_args)
if (!missing(load_args)) params$load_args <- jsonlite::unbox(load_args)
res <- httr::GET(splash_url(splash_obj), path="render.html", encode="json", query=params)

38
R/render-jpg.r

@ -8,32 +8,36 @@
#' @references [Splash docs](http://splash.readthedocs.io/en/stable/index.html)
#' @export
render_jpeg <- render_jpg <- function(
splash_obj = splash_local, url, base_url=NULL, quality=75, width=1024, height=768,
timeout=30, resource_timeout, wait=0, render_all=FALSE,
splash_obj = splash_local, url, base_url=NULL, quality=75, width, height,
timeout=30, resource_timeout, wait=0, render_all=TRUE,
proxy, js, js_src, filters, allowed_domains, allowed_content_types,
forbidden_content_types, viewport="1024x768", images, headers, body,
forbidden_content_types, viewport="full", images, headers, body,
http_method, save_args, load_args) {
params <- list(url=url, timeout=timeout,
wait=if (render_all & wait == 0) 0.5 else wait,
viewport=viewport,
quality=quality, width=width, height=height, render_all=as.numeric(render_all))
quality=quality,
render_all=as.numeric(render_all))
if (!missing(base_url)) params$base_url <- base_url
if (!missing(width)) params$width <- width
if (!missing(height)) params$height <- height
if (!missing(base_url)) params$base_url <- jsonlite::unbox(base_url)
if (!missing(resource_timeout)) params$resource_timeout <- resource_timeout
if (!missing(proxy)) proxy$base_url <- proxy
if (!missing(js)) params$js <- js
if (!missing(js_src)) params$js_src <- js_src
if (!missing(filters)) params$filters <- filters
if (!missing(allowed_domains)) params$allowed_domains <- allowed_domains
if (!missing(allowed_content_types)) params$allowed_content_types <- allowed_content_types
if (!missing(forbidden_content_types)) params$forbidden_content_types <- forbidden_content_types
if (!missing(images)) params$images <- images
if (!missing(proxy)) params$proxy <- jsonlite::unbox(proxy)
if (!missing(js)) params$js <- jsonlite::unbox(js)
if (!missing(js_src)) params$js_src <- jsonlite::unbox(js_src)
if (!missing(filters)) params$filters <- jsonlite::unbox(filters)
if (!missing(allowed_domains)) params$allowed_domains <- jsonlite::unbox(allowed_domains)
if (!missing(allowed_content_types)) params$allowed_content_types <- jsonlite::unbox(allowed_content_types)
if (!missing(forbidden_content_types)) params$forbidden_content_types <- jsonlite::unbox(forbidden_content_types)
if (!missing(images)) params$images <- as.numeric(images)
if (!missing(headers)) params$headers <- headers
if (!missing(body)) params$body <- body
if (!missing(http_method)) params$http_method <- http_method
if (!missing(save_args)) params$save_args <- save_args
if (!missing(load_args)) params$load_args <- load_args
if (!missing(body)) params$body <- jsonlite::unbox(body)
if (!missing(http_method)) params$http_method <- jsonlite::unbox(http_method)
if (!missing(save_args)) params$save_args <- jsonlite::unbox(save_args)
if (!missing(load_args)) params$load_args <- jsonlite::unbox(load_args)
res <- httr::GET(splash_url(splash_obj), path="render.jpeg", encode="json", query=params)

37
R/render-json.r

@ -27,7 +27,7 @@
#' overwhelmed with data. Use [str()] to inspect various portions of the result.
#' @references [Splash docs](http://splash.readthedocs.io/en/stable/index.html)
#' @export
render_json <- function(splash_obj = splash_local, url, base_url=NULL, quality=75, width=1024, height=768,
render_json <- function(splash_obj = splash_local, url, base_url=NULL, quality=75, width, height,
timeout=30, resource_timeout, wait=0, render_all=FALSE,
proxy, js, js_src, filters, allowed_domains, allowed_content_types,
forbidden_content_types, viewport="1024x768", images, headers, body,
@ -35,28 +35,31 @@ render_json <- function(splash_obj = splash_local, url, base_url=NULL, quality=7
iframes=TRUE, script=TRUE, console=TRUE, history=TRUE, har=TRUE,
response_body=FALSE) {
params <- list(url=url, timeout=timeout, wait=wait, viewport=viewport,
quality=quality, width=width, height=height, render_all=as.numeric(render_all),
params <- list(url=url, timeout=timeout, wait=wait, viewport=jsonlite::unbox(viewport),
quality=quality, render_all=as.numeric(render_all),
html=as.numeric(html), png=as.numeric(png), jpeg=as.numeric(jpeg),
iframes=as.numeric(iframes), script=as.numeric(script),
console=as.numeric(console), history=as.numeric(history), har=as.numeric(har),
response_body=as.numeric(response_body))
if (!missing(base_url)) params$base_url <- base_url
if (!missing(width)) params$width <- width
if (!missing(height)) params$height <- height
if (!missing(base_url)) params$base_url <- jsonlite::unbox(base_url)
if (!missing(resource_timeout)) params$resource_timeout <- resource_timeout
if (!missing(proxy)) proxy$base_url <- proxy
if (!missing(js)) params$js <- js
if (!missing(js_src)) params$js_src <- js_src
if (!missing(filters)) params$filters <- filters
if (!missing(allowed_domains)) params$allowed_domains <- allowed_domains
if (!missing(allowed_content_types)) params$allowed_content_types <- allowed_content_types
if (!missing(forbidden_content_types)) params$forbidden_content_types <- forbidden_content_types
if (!missing(images)) params$images <- images
if (!missing(proxy)) params$proxy <- jsonlite::unbox(proxy)
if (!missing(js)) params$js <- jsonlite::unbox(js)
if (!missing(js_src)) params$js_src <- jsonlite::unbox(js_src)
if (!missing(filters)) params$filters <- jsonlite::unbox(filters)
if (!missing(allowed_domains)) params$allowed_domains <- jsonlite::unbox(allowed_domains)
if (!missing(allowed_content_types)) params$allowed_content_types <- jsonlite::unbox(allowed_content_types)
if (!missing(forbidden_content_types)) params$forbidden_content_types <- jsonlite::unbox(forbidden_content_types)
if (!missing(images)) params$images <- as.numeric(images)
if (!missing(headers)) params$headers <- headers
if (!missing(body)) params$body <- body
if (!missing(http_method)) params$http_method <- http_method
if (!missing(save_args)) params$save_args <- save_args
if (!missing(load_args)) params$load_args <- load_args
if (!missing(body)) params$body <- jsonlite::unbox(body)
if (!missing(http_method)) params$http_method <- jsonlite::unbox(http_method)
if (!missing(save_args)) params$save_args <- jsonlite::unbox(save_args)
if (!missing(load_args)) params$load_args <- jsonlite::unbox(load_args)
res <- httr::GET(splash_url(splash_obj), path="render.json", encode="json", query=params)
@ -106,4 +109,4 @@ render_json <- function(splash_obj = splash_local, url, base_url=NULL, quality=7
print.splash_json <- function(x, ...) {
cat("<splashr render_json() object>")
invisible(x)
}
}

39
R/render-png.r

@ -1,39 +1,42 @@
#' Return a image (in PNG format) of the javascript-rendered page.
#'
#' @md
#' @param width,height Resize the rendered image to the given width/height (in pixels) keeping the aspect ratio.
#' @param width,height Resize the rendered image to the given width/height (in pixels) keeping the aspect ratio. These are optional
#' @param render_all If `TRUE` extend the viewport to include the whole webpage (possibly very tall) before rendering.
#' @return a [magick] image object
#' @references [Splash docs](http://splash.readthedocs.io/en/stable/index.html)
#' @inheritParams render_html
#' @export
render_png <- function(
splash_obj = splash_local, url, base_url=NULL, width=1024, height=768,
timeout=30, resource_timeout, wait=0, render_all=FALSE,
splash_obj = splash_local, url, base_url=NULL, width, height,
timeout=30, resource_timeout, wait=0, render_all=TRUE,
proxy, js, js_src, filters, allowed_domains, allowed_content_types,
forbidden_content_types, viewport="1024x768", images, headers, body,
forbidden_content_types, viewport="full", images, headers, body,
http_method, save_args, load_args) {
params <- list(url=url, timeout=timeout,
wait=if (render_all & wait == 0) 0.5 else wait,
viewport=viewport, width=width, height=height,
viewport=jsonlite::unbox(viewport),
render_all=as.numeric(render_all))
if (!missing(base_url)) params$base_url <- base_url
if (!missing(width)) params$width <- width
if (!missing(height)) params$height <- height
if (!missing(base_url)) params$base_url <- jsonlite::unbox(base_url)
if (!missing(resource_timeout)) params$resource_timeout <- resource_timeout
if (!missing(proxy)) proxy$base_url <- proxy
if (!missing(js)) params$js <- js
if (!missing(js_src)) params$js_src <- js_src
if (!missing(filters)) params$filters <- filters
if (!missing(allowed_domains)) params$allowed_domains <- allowed_domains
if (!missing(allowed_content_types)) params$allowed_content_types <- allowed_content_types
if (!missing(forbidden_content_types)) params$forbidden_content_types <- forbidden_content_types
if (!missing(images)) params$images <- images
if (!missing(proxy)) params$proxy <- jsonlite::unbox(proxy)
if (!missing(js)) params$js <- jsonlite::unbox(js)
if (!missing(js_src)) params$js_src <- jsonlite::unbox(js_src)
if (!missing(filters)) params$filters <- jsonlite::unbox(filters)
if (!missing(allowed_domains)) params$allowed_domains <- jsonlite::unbox(allowed_domains)
if (!missing(allowed_content_types)) params$allowed_content_types <- jsonlite::unbox(allowed_content_types)
if (!missing(forbidden_content_types)) params$forbidden_content_types <- jsonlite::unbox(forbidden_content_types)
if (!missing(images)) params$images <- as.numeric(images)
if (!missing(headers)) params$headers <- headers
if (!missing(body)) params$body <- body
if (!missing(http_method)) params$http_method <- http_method
if (!missing(save_args)) params$save_args <- save_args
if (!missing(load_args)) params$load_args <- load_args
if (!missing(body)) params$body <- jsonlite::unbox(body)
if (!missing(http_method)) params$http_method <- jsonlite::unbox(http_method)
if (!missing(save_args)) params$save_args <- jsonlite::unbox(save_args)
if (!missing(load_args)) params$load_args <- jsonlite::unbox(load_args)
res <- httr::GET(splash_url(splash_obj), path="render.png", encode="json", query=params)

2
R/splashr-package.R

@ -18,7 +18,7 @@
#' @importFrom stringi stri_split_regex stri_split_fixed stri_detect_regex
#' @importFrom HARtools writeHAR HARviewer renderHARviewer HARviewerOutput
#' @importFrom xml2 read_html url_parse
#' @importFrom jsonlite fromJSON
#' @importFrom jsonlite fromJSON unbox
#' @importFrom openssl base64_decode
#' @importFrom clipr read_clip
#' @importFrom lubridate ymd_hms

2
man/render_har.Rd

@ -39,7 +39,7 @@ render_har(splash_obj = splash_local, url, base_url, response_body = FALSE,
\item{forbidden_content_types}{Comma-separated list of forbidden content types. If present, Splash will abort any request if the response’s content type matches any of the content types in this list. Wildcards are supported.}
\item{viewport}{View width and height (in pixels) of the browser viewport to render the web page. Format is “<width>x<height>”, e.g. 800x600. Default value is 1024x768.}
\item{viewport}{View width and height (in pixels) of the browser viewport to render the web page. Format is “<width>x<height>”, e.g. 800x600. Default value is "full".}
\item{images}{Whether to download images.}

2
man/render_html.Rd

@ -36,7 +36,7 @@ render_html(splash_obj = splash_local, url, base_url, timeout = 30,
\item{forbidden_content_types}{Comma-separated list of forbidden content types. If present, Splash will abort any request if the response’s content type matches any of the content types in this list. Wildcards are supported.}
\item{viewport}{View width and height (in pixels) of the browser viewport to render the web page. Format is “<width>x<height>”, e.g. 800x600. Default value is 1024x768.}
\item{viewport}{View width and height (in pixels) of the browser viewport to render the web page. Format is “<width>x<height>”, e.g. 800x600. Default value is "full".}
\item{images}{Whether to download images.}

14
man/render_jpeg.Rd

@ -5,10 +5,10 @@
\title{Return a image (in JPEG format) of the javascript-rendered page.}
\usage{
render_jpeg(splash_obj = splash_local, url, base_url = NULL, quality = 75,
width = 1024, height = 768, timeout = 30, resource_timeout, wait = 0,
render_all = FALSE, proxy, js, js_src, filters, allowed_domains,
allowed_content_types, forbidden_content_types, viewport = "1024x768",
images, headers, body, http_method, save_args, load_args)
width, height, timeout = 30, resource_timeout, wait = 0,
render_all = TRUE, proxy, js, js_src, filters, allowed_domains,
allowed_content_types, forbidden_content_types, viewport = "full", images,
headers, body, http_method, save_args, load_args)
}
\arguments{
\item{splash_obj}{Object created by a call to \code{\link[=splash]{splash()}}}
@ -19,9 +19,9 @@ render_jpeg(splash_obj = splash_local, url, base_url = NULL, quality = 75,
\item{quality}{JPEG quality parameter in range from 0 to 100. Default is quality=75.}
\item{width}{Resize the rendered image to the given width/height (in pixels) keeping the aspect ratio.}
\item{width}{Resize the rendered image to the given width/height (in pixels) keeping the aspect ratio. These are optional}
\item{height}{Resize the rendered image to the given width/height (in pixels) keeping the aspect ratio.}
\item{height}{Resize the rendered image to the given width/height (in pixels) keeping the aspect ratio. These are optional}
\item{timeout}{A timeout (in seconds) for the render (defaults to 30).}
@ -45,7 +45,7 @@ render_jpeg(splash_obj = splash_local, url, base_url = NULL, quality = 75,
\item{forbidden_content_types}{Comma-separated list of forbidden content types. If present, Splash will abort any request if the response’s content type matches any of the content types in this list. Wildcards are supported.}
\item{viewport}{View width and height (in pixels) of the browser viewport to render the web page. Format is “<width>x<height>”, e.g. 800x600. Default value is 1024x768.}
\item{viewport}{View width and height (in pixels) of the browser viewport to render the web page. Format is “<width>x<height>”, e.g. 800x600. Default value is "full".}
\item{images}{Whether to download images.}

8
man/render_json.Rd

@ -5,7 +5,7 @@
\title{Return a json-encoded dictionary with information about javascript-rendered webpage.}
\usage{
render_json(splash_obj = splash_local, url, base_url = NULL, quality = 75,
width = 1024, height = 768, timeout = 30, resource_timeout, wait = 0,
width, height, timeout = 30, resource_timeout, wait = 0,
render_all = FALSE, proxy, js, js_src, filters, allowed_domains,
allowed_content_types, forbidden_content_types, viewport = "1024x768",
images, headers, body, http_method, save_args, load_args, html = TRUE,
@ -21,9 +21,9 @@ render_json(splash_obj = splash_local, url, base_url = NULL, quality = 75,
\item{quality}{JPEG quality parameter in range from 0 to 100. Default is quality=75.}
\item{width}{Resize the rendered image to the given width/height (in pixels) keeping the aspect ratio.}
\item{width}{Resize the rendered image to the given width/height (in pixels) keeping the aspect ratio. These are optional}
\item{height}{Resize the rendered image to the given width/height (in pixels) keeping the aspect ratio.}
\item{height}{Resize the rendered image to the given width/height (in pixels) keeping the aspect ratio. These are optional}
\item{timeout}{A timeout (in seconds) for the render (defaults to 30).}
@ -47,7 +47,7 @@ render_json(splash_obj = splash_local, url, base_url = NULL, quality = 75,
\item{forbidden_content_types}{Comma-separated list of forbidden content types. If present, Splash will abort any request if the response’s content type matches any of the content types in this list. Wildcards are supported.}
\item{viewport}{View width and height (in pixels) of the browser viewport to render the web page. Format is “<width>x<height>”, e.g. 800x600. Default value is 1024x768.}
\item{viewport}{View width and height (in pixels) of the browser viewport to render the web page. Format is “<width>x<height>”, e.g. 800x600. Default value is "full".}
\item{images}{Whether to download images.}

14
man/render_png.Rd

@ -4,11 +4,11 @@
\alias{render_png}
\title{Return a image (in PNG format) of the javascript-rendered page.}
\usage{
render_png(splash_obj = splash_local, url, base_url = NULL, width = 1024,
height = 768, timeout = 30, resource_timeout, wait = 0,
render_all = FALSE, proxy, js, js_src, filters, allowed_domains,
allowed_content_types, forbidden_content_types, viewport = "1024x768",
images, headers, body, http_method, save_args, load_args)
render_png(splash_obj = splash_local, url, base_url = NULL, width, height,
timeout = 30, resource_timeout, wait = 0, render_all = TRUE, proxy, js,
js_src, filters, allowed_domains, allowed_content_types,
forbidden_content_types, viewport = "full", images, headers, body,
http_method, save_args, load_args)
}
\arguments{
\item{splash_obj}{Object created by a call to \code{\link[=splash]{splash()}}}
@ -17,7 +17,7 @@ render_png(splash_obj = splash_local, url, base_url = NULL, width = 1024,
\item{base_url}{The base url to render the page with.}
\item{width, height}{Resize the rendered image to the given width/height (in pixels) keeping the aspect ratio.}
\item{width, height}{Resize the rendered image to the given width/height (in pixels) keeping the aspect ratio. These are optional}
\item{timeout}{A timeout (in seconds) for the render (defaults to 30).}
@ -41,7 +41,7 @@ render_png(splash_obj = splash_local, url, base_url = NULL, width = 1024,
\item{forbidden_content_types}{Comma-separated list of forbidden content types. If present, Splash will abort any request if the response’s content type matches any of the content types in this list. Wildcards are supported.}
\item{viewport}{View width and height (in pixels) of the browser viewport to render the web page. Format is “<width>x<height>”, e.g. 800x600. Default value is 1024x768.}
\item{viewport}{View width and height (in pixels) of the browser viewport to render the web page. Format is “<width>x<height>”, e.g. 800x600. Default value is "full".}
\item{images}{Whether to download images.}

12
tests/testthat/test-splash.R

@ -1,16 +1,18 @@
context("basic functionality")
test_that("we can do something", {
test_url <- "http://localhost:8050/"
xpct <- function(x) {
spact <- splash_active()
expect_that(spact, equals(TRUE))
expect_that(length(splash_debug()), equals(7))
expect_that(length(splash_version()), equals(9))
expect_that(render_json(url = "https://httpbin.org/get"), is_a("splash_json"))
expect_that(render_png(url = "https://httpbin.org/get"), is_a("magick-image"))
expect_that(render_png(url = "https://httpbin.org/get"), is_a("magick-image"))
expect_that(render_html(url = "https://httpbin.org/get"), is_a("xml_document"))
expect_that(render_har(url = "https://httpbin.org/get"), is_a("har"))
expect_that(render_json(url = test_url), is_a("splash_json"))
expect_that(render_jpeg(url = test_url), is_a("magick-image"))
expect_that(render_png(url = test_url), is_a("magick-image"))
expect_that(render_html(url = test_url), is_a("xml_document"))
expect_that(render_har(url = test_url), is_a("har"))
}
spact <- splash_active()

Loading…
Cancel
Save