我尝试使用任务调度程序在Windows 8中自动运行R脚本,正如petermeissner在this主题中解释的那样。下面我粘贴(部分)脚本。该脚本执行所有操作,直到remDr$getPageSourece()
。我收到一条弹出消息,说“Windows前端的R已停止工作”。但是,如果我在R中运行脚本(因此不使用调度程序),则不会发生错误。什么可能是错的?
pacman::p_load(RSelenium)
appurl <- "https://prod.beeline.com/ucb/Security/NewLogin.aspx?Url=%2fucb"
setwd("../downloaded")
RSelenium::checkForServer()
RSelenium::startServer()
Sys.sleep(5)
remDr <- RSelenium::remoteDriver(browserName="chrome") #For chrome make sure the file 'chromedriver is under 'downloaded'. Also this file can be found on TFS
remDr$open(silent=T)
remDr$navigate(appurl)
Sys.sleep(1)
remDr$findElement(using = "css selector","#beelineForm_UserLoginForm_userNameText")$sendKeysToElement(list("username"))
Sys.sleep(1)
remDr$findElement(using = "css selector","#beelineForm_UserLoginForm_passwordText")$sendKeysToElement(list("passwd"))
remDr$findElement("css selector", "#loginButton")$clickElement()
appurlNew <- "https://prod.beeline.com/ucb/Procurement/Request/ProcurementRequestListScreen.ascx"
Sys.sleep(1)
remDr$navigate(appurlNew)
Sys.sleep(3)
x <- getwd()
write(x, file="workingdir1.txt")
remDr$getPageSource()
编辑:我尝试在R中重新运行脚本,现在它似乎也在remDr$getPageSource()
处阻止。 R表示它会搜索功能定义&#39;直到会议中止。