Skip to content

Instantly share code, notes, and snippets.

@StevenMMortimer
Created April 6, 2016 13:13
Show Gist options
  • Save StevenMMortimer/90b7db0f4e515337f50e6a92fe152ac1 to your computer and use it in GitHub Desktop.
Save StevenMMortimer/90b7db0f4e515337f50e6a92fe152ac1 to your computer and use it in GitHub Desktop.
library(RSelenium)
appURL <- "XXXXXX.com"
username <- "myusername"
password <- "mypassword"
RSelenium::startServer()
library(RSelenium)
RSelenium::startServer()
pJS <- phantom(pjs_cmd='path/to/phantomjs',
extras=c("--ssl-protocol=any"))
Sys.sleep(5) # give the binary a moment
eCap <- list(phantomjs.page.settings.userAgent
= "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:29.0) Gecko/20120101 Firefox/29.0")
remDr <- remoteDriver(browserName = "phantomjs", extraCapabilities = eCap)
Sys.sleep(5) # give the binary a moment
remDr$open()
Sys.sleep(5) # give the binary a moment
#pJS$stop()
remDr$navigate(appURL)
remDr$getPageSource()
userName <- remDr$findElement("id", "username")
userName$sendKeysToElement(list(username))
passWord <- remDr$findElement("id", "passwordword")
passWord$sendKeysToElement(list(password))
logIn <- remDr$findElement("id", "LoginButton")
logIn$clickElement()
remDr$navigate('xxxx')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment