Ama*_*yan 5 r shiny shiny-server rselenium
我遇到了这样一个问题:我有使用RSelenium导航页面,单击按钮并收集数据的Rscript。我将此脚本作为功能包含在我的ShinyApp中。当我从机器上运行它时,一切都按预期进行:单击按钮后,Firefox启动并正确运行。
当我想在我公司的Rstudio服务器上(在Linux下)发布脚本以便通过链接提供对工具(在Windows下编写)的访问时,发生了麻烦。运行此命令后:
rD<-rsDriver(port=4441L, browser="firefox", chromever=NULL, iedrver = NULL, phantomver = NULL)
Run Code Online (Sandbox Code Playgroud)
A收到以下输出:
$client
[1] "No sessionInfo. Client browser is mostly likely not opened."
$server
Process Handle
command : /tmp/RtmpElIBko/file3a0241d505d8.sh
system id : 15293
state : exited
Run Code Online (Sandbox Code Playgroud)
因此服务器正在运行,但是无法打开浏览器
服务器日志为:
$stderr
[1] "14:22:06.908 INFO [GridLauncherV3.launch] - Selenium build info: version: '3.12.0', revision: '7c6e0b3'"
[2] "14:22:06.910 INFO [GridLauncherV3$1.launch] - Launching a standalone Selenium Server on port 4441"
[3] "2018-05-15 14:22:07.026:INFO::main: Logging initialized @452ms to org.seleniumhq.jetty9.util.log.StdErrLog"
[4] "14:22:07.227 INFO [SeleniumServer.boot] - Selenium Server is up and running on port 4441"
[5] "14:22:08.467 INFO [ActiveSessionFactory.apply] - Capabilities are: Capabilities {browserName: firefox, javascriptEnabled: true, nativeEvents: true, version: }"
[6] "14:22:08.469 INFO [ActiveSessionFactory.lambda$apply$11] - Matched factory org.openqa.selenium.remote.server.ServicedSession$Factory (provider: org.openqa.selenium.firefox.GeckoDriverService)"
[7] "1526383328500\tgeckodriver\tINFO\tgeckodriver 0.20.1"
[8] "1526383328506\tgeckodriver\tINFO\tListening on 127.0.0.1:30716"
[9] "1526383328777\tmozrunner::runner\tINFO\tRunning command: \"/usr/bin/firefox\" \"-marionette\" \"-profile\" \"/tmp/rust_mozprofile.KCqtcRfWkHTS\""
[10] "No protocol specified"
[11] "Error: cannot open display: :0"
Run Code Online (Sandbox Code Playgroud)
我的想法:在本地计算机上,我安装了浏览器,并且其路径存储在PATH变量中。服务器中没有任何内容,因此尚不清楚应打开什么内容。
我试图做的是:这一次我正在等待IT部门在服务器上安装浏览器(我什至不知道这听起来是否疯狂),因为我没有权限。我将Mozilla浏览器从我的计算机上载到服务器,并运行了以下代码行以直接启动没有RSelenium的浏览器:
system('java -Dwebdriver.firefox.bin="\\R\\Wordstat Yandex\\Mozilla\\firefox.exe"')
system('java -Dwebdriver.gecko.driver,"R\\Wordstat Yandex\\geckodriver"')
system('export PATH=$PATH:"\\R\\Wordstat Yandex\\Mozilla\\firefox.exe"')
system("./firefox.exe")
Run Code Online (Sandbox Code Playgroud)
返回权限错误:
sh: ./firefox.exe: Permission denied
Run Code Online (Sandbox Code Playgroud)
所以我的问题是:
这次,我在Google看到的是如何使用RSelenium测试Shinyapp。如果我将这两个词放在一个搜索查询中,则结果大致相同。
非常感谢您的帮助)
| 归档时间: |
|
| 查看次数: |
265 次 |
| 最近记录: |