title: Why does rvest pull empty data when inclosed in loop?
body: <p>I'm trying to scrape hotel reviews from a certain hotel on from tripadvisor. I'm using Rvest to accomplish my goal. This script has to scrape multiple pages. </p>
  
  <p>When executing my script rvest sometimes returns vectors with empty values when executing in a loop. This is completely random. Does anyone have a fix for this?</p>
  
  <p>I tried manually walking trough the script. When i slowly go trough it it works most of the time, but sometimes still manages to pull empty data.</p>
  
  <pre><code># Webscrapen
  df &lt;- data.frame()
  x = 0
  
  for(i in 1:250){
    url &lt;- paste("https://www.tripadvisor.com/Hotel_Review-g295424-d7760386-Reviews-or",x,"-Hyatt_Regency_Dubai_Creek_Heights-Dubai_Emirate_of_Dubai.html", sep = "")
    x = x + 5
  
    reviews &lt;- url %&gt;%
      read_html() %&gt;%
      html_nodes('.common-text-ReadMore__content--2X4LR') %&gt;%
      html_node('.hotels-hotel-review-community-content-review-list-parts-ExpandableReview__reviewText--2OVqJ span') %&gt;%
      html_text()
  
    rating &lt;- url %&gt;%
      read_html() %&gt;%
      html_nodes(".hotels-hotel-review-community-content-review-list-parts-RatingLine__bubbles--3d2Be span") %&gt;%
      html_attr("class")
  
    rating &lt;- sapply(strsplit(rating, "_"), `[`, 4) %&gt;% 
      as.numeric()
  
    if(nrow(df) == 0){
      df &lt;- data.frame(reviews[!is.na(reviews)], rating, stringsAsFactors = F)
    } else {
      temp &lt;- df
      df &lt;- rbind(temp, data.frame(reviews[!is.na(reviews)], rating, stringsAsFactors = F))
    }
  }
  </code></pre>
  
  <p>I expect to scrape all the reviews till my for loop stops. I should have a dataframe of at least 100 reviews.</p>