导航网站以抓取数据时出错

时间:2017-06-28 05:20:48

标签: r web-scraping phantomjs rvest rselenium

我正在抓取网站的数据,但是当我使用命令remDr$navigate("http://www.magicbricks.com/property-for-sale/residential-real-estate?bedroom=1&proptype=Multistorey-Apartment,Builder-Floor-Apartment,Penthouse,Studio-Apartment&cityName=Thane&BudgetMin=5-Lacs&BudgetMax=10-Lacs")

浏览网站时

它在命令提示符下给我错误

phantomjs://platform/console++.js:263 in error
[ERROR - 2017-06-28T05:01:51.466Z] Session [c5653e70-5bbe-11e7-9496-47f479558959] - page.onError - msg: ReferenceError: Can't find variable: paramTraffic

  phantomjs://platform/console++.js:263 in error
[ERROR - 2017-06-28T05:01:51.467Z] Session [c5653e70-5bbe-11e7-9496-47f479558959] - page.onError - stack:
  initializeDSS (https://cdn.staticmb.com/scripts/header.js:1)

  phantomjs://platform/console++.js:263 in error
10:31:52.411 INFO - Done: [get: http://www.magicbricks.com/property-for-sale/residential-real-estate?bedroom=1&proptype=Multistorey-Apartment,Builder-Floor-Apartment,Penthouse,Studio-Apartment&cityName=Thane&BudgetMin=5-Lacs&BudgetMax=10-Lacs]

但是当我浏览其他网站时,它会顺利执行

remDr$navigate("http://www.r-project.org")

10:45:21.810 INFO - Executing: [get: http://www.r-project.org])
10:45:21.938 INFO - Done: [get: http://www.r-project.org]

这是我的代码片段

library(RSelenium)
library(wdman)
pJS <- phantomjs("C:/Users/user/Downloads/phantomjs-2.1.1-windows/phantomjs-2.1.1-windows/bin/phantomjs.exe",port = 4566L,version = "2.1.1",check = T,loglevel = c("INFO", "ERROR", "WARN", "DEBUG"), verbose = TRUE, retcommand = FALSE)

remDr <- remoteDriver(browserName = "phantomjs")
remDr$open()
remDr$navigate("http://www.magicbricks.com/property-for-sale/residential-real-estate?bedroom=1&proptype=Multistorey-Apartment,Builder-Floor-Apartment,Penthouse,Studio-Apartment&cityName=Thane&BudgetMin=5-Lacs&BudgetMax=10-Lacs")

有没有人知道为什么会这样。

提前致谢。

  

P.S:我正在使用selenium服务器版本3.3.1 Windows 10   基本驱动程序位于我的selenium服务器所在的目录中   使用phantomjs-2.1.1-windows浏览器

0 个答案:

没有答案
相关问题