[问题] 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