RSelenium安装和使用
1、安装geckodriver
下载https://github.com/mozilla/geckodriver/releases
sudo cp ./geckodriver / /usr/local/bin/
sudo chmod 755 /usr/local/bin/geckodriver
2、安装Selenium Server
下载https://selenium-release.storage.googleapis.com/index.html
sudo cp selenium-server-standalone-3.9.1.jar /usr/local/bin/
sudo chmod 755 /usr/local/bin/selenium-server-standalone-3.9.1.jar
3、运行Selenium Server
java -jar selenium-server-standalone-3.9.1.jar
4、
library(RSelenium)
rD <- rsDriver()
remDr <- remoteDriver(
remoteServerAddr = "localhost",
port = 4444,
browserName = "firefox")
#打开浏览器
remDr$open()
# 瀏覽 Google 首頁
remDr$navigate("https://www.google.com/")
下载https://github.com/mozilla/geckodriver/releases
sudo cp ./geckodriver / /usr/local/bin/
sudo chmod 755 /usr/local/bin/geckodriver
2、安装Selenium Server
下载https://selenium-release.storage.googleapis.com/index.html
sudo cp selenium-server-standalone-3.9.1.jar /usr/local/bin/
sudo chmod 755 /usr/local/bin/selenium-server-standalone-3.9.1.jar
3、运行Selenium Server
java -jar selenium-server-standalone-3.9.1.jar
4、
library(RSelenium)
rD <- rsDriver()
remDr <- remoteDriver(
remoteServerAddr = "localhost",
port = 4444,
browserName = "firefox")
#打开浏览器
remDr$open()
# 瀏覽 Google 首頁
remDr$navigate("https://www.google.com/")
评论
发表评论