Skip to content

Commit

Permalink
Check that phantomjs was built with ghostdriver
Browse files Browse the repository at this point in the history
  • Loading branch information
wch committed Feb 14, 2018
1 parent 0d60a31 commit 52facdb
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

* Try to find locally-install phantomjs first.

* `Session$new()` now checks that the phantomjs binary was built with ghostdriver support.


# 1.0.3

Expand Down
17 changes: 17 additions & 0 deletions R/session.R
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,23 @@ session_initialize <- function(self, private, host, port) {
## Set initial windows size to something sane
self$getWindow()$setSize(992, 744)

## Try to run a very basic script. If this fails, it probably means that the
## phantomjs binary was not built with ghostdriver.
## https://github.com/rstudio/shinytest/issues/165
tryCatch(
self$executeScript("1"),
error = function(e) {
if (grepl("Unable to load Atom.*ghostdriver", e$message)) {
e$message <- paste0(
e$message,
"\nThis is probably because your phantomjs binary (",
find_phantom(), ") was not built with ghostdriver support.",
"\nTry running webdriver::install_phantomjs() and restarting R."
)
}
stop(e)
})

invisible(self)
}

Expand Down

0 comments on commit 52facdb

Please sign in to comment.