作者sky800507 (B翰)
看板R_Language
标题[问题] Rselenium findElement 如何找第二项?
时间Thu Aug 18 00:16:39 2016
我想用Rselenium在Google Map上自动搜寻,并将搜寻到的地址、网站、电话都爬下来,可是目前只能爬到地址。
程式码如下:
library(RSelenium)
startServer()
mybrowser <- remoteDriver()
mybrowser$open()
mybrowser$navigate("
https://www.google.com.tw/maps/")
Sys.sleep(3)
search <- mybrowser$findElement(using = "css selector", "
#searchboxinput")
search$sendKeysToElement(list("taiwan university","\uE007"))
mybrowser$findElement(using = "css selector", ".widget-pane-section-info-text")$getElementText()
网站的class也是widget-pane-section-info-text,但我不知道如何搜寻到第二项,爬了好久资讯都还没找到解答,有人有遇过类似的问题吗?
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 61.230.3.106
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/R_Language/M.1471450602.A.941.html