I am trying to scrape a table that I believe is using Java script. I want to get the data for indices (i.e., TSX). I would like to get the "Previous day data" for all indices. I am scraping the data using Rselenium but it is unable to locate the element.
Following is my code for scraping previous day data for index called TSX:
library(RSelenium)
driver<- rsDriver(browser = "firefox")
remDr <- driver[["client"]]
remDr$navigate("http://bmgfunds.com/interactive-charts/")
elem <- remDr$findElement(using="xpath", value="//*[@id='indices-quotes']/table/tbody/tr[1]/td[2]")
In order to get the Xpath, I inspected the element and copied the Xpath by right clicking in the pan. I also tried using rvest.
library(rvest)
st_table <- read_html("http://bmgfunds.com/interactive-charts/")
table<-html_nodes(st_table, "tbody tr")
Unfortunately, I get zero element {xml_nodeset (0)}
Any suggestion or help will be appreciated.