[問題] Rselenium findElement 如何找第二項?

作者: sky800507 (B翰)   2016-08-18 00:16:39
我想用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,但我不知道如何搜尋到第二項,爬了好久資訊都還沒找到解答,有人有遇過類似的問題嗎?

Links booklink

Contact Us: admin [ a t ] ucptt.com