[問題] Rselenium findElement 如何找第二項?
我想用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://www.ptt.cc/bbs/R_Language/M.1471450602.A.941.html
R_Language 近期熱門文章
PTT數位生活區 即時熱門文章