I need to get data of the oil price table formed by javascript so that I can have it onto data.frame in R.
In the below codes, I am able to open the url in chrome browser using RSelenium but I am unable to extract the table of historical oil price in xpath [@id='historic-price-list']/div/div[2]/table. The below doesn't seem to give me a table or the values I wanted. https://markets.businessinsider.com/commodities/historical-prices/oil-price/usd?type=brent
library('RSelenium')
rD <- rsDriver(browser = "chrome")
remDr <- rD[["client"]] #Start Chrome.
siteAdd <- "https://markets.businessinsider.com/commodities/historical-prices/oil-price/usd?type=brent"
remDr$navigate(siteAdd) #Open the site.
abc=remDr$findElement("css selector","//*[@id='historic-price-list']/div/div[2]/table > tbody > tr:nth-child(1) > th:nth-child(1)")$getElementText()
I hope to get it onto a table which I can put it onto data.frame.