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

看板R_Language作者 (B翰)時間9年前 (2016/08/18 00:16), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/1
我想用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
文章代碼(AID): #1Nj8tgb1 (R_Language)
文章代碼(AID): #1Nj8tgb1 (R_Language)