I want to web scrap all properties from this web page.
When I tried the following code, I only get the details of 1 property on the page.
library(tidyverse)
library(rvest)
library(RSelenium)
library(stringr)
rD <- rsDriver(browser = "chrome",port = 4234L,chromever = "99.0.4844.51")
remDr <- rD[["client"]]
# test Willhaben
goTo <- remDr$navigate("https://www.immobilienscout24.de/Suche/de/bayern/muenchen/haus-kaufen?pagenumber=3")
Lego <- read_html(remDr$getPageSource(goTo)[[1]])
rooms <- Lego %>% html_element(".iLQwFF+ .iLQwFF .jXuiQ") %>%
html_text()
address <- Lego %>% html_element("#skip-to-resultlist .hdZkVR") %>%
html_text()
cost <- Lego %>% html_element(".result-list-entry__primary-criterion:nth-child(1) .font-highlight") %>%
html_text()
surface <- Lego %>% html_element(".result-list-entry__primary-criterion:nth-child(2) .font-highlight") %>%
html_text()
href <- Lego %>% html_element("a.result-list-entry__brand-title-container ") %>%
html_attr('href')
apt_link <- paste0("https://www.immobilienscout24.de",href)
Munich_flat <- data.frame(apt_link, rooms, surface, cost, address)
How can I web scrap all properties on this page?
Thank you in advance.