I am trying to scrape the names of each of the search results from this page using the code below:
url2 <- "http://www.truckandtrailer.ca/search.cfm?intIndustryID=2&searchtype=advanced&pageaction=showresults&bitNew=0&intCategoryID=30&intMakeID=0&intSelectProvinceID=&x=26&y=6"
results <- url2 %>%
html() %>%
html_nodes(".desc_title") %>%
html_text()
results
However it just returns:
character(0)
Any thoughts on how to fix this? Appreciate the help!
Here is the solution using RSelenium and rvest.
Note: Please see my answer here for working with RSelenium and rvest.
Another approach is to use Phantomjs (no need to use cmd and no extra browser). The only thing that you need here is to download the exe file from here and place this in your R working directory (you can also specify the path if you don't want to place this in your working directory).
P.S. Please see the help file for details.