I am learning web scraping on my own and I am trying to scrap reviewer's ratings on Yelp as a practice. Typically, I can use CSS selector or XPath methods to select the contents I am interested in. However, those methods do not work for selecting reviewers' ratings. For instance, on the following page: https://www.yelp.com/user_details_reviews_self?userid=0S6EI51ej5J7dgYz3-O0lA. The CSS selector for the first rating is '.stars_2'. However, if I use this selector in my RSelenium code as follows:
ratings=remDr$findElements('css selector','.stars_2')
ratings=unlist(lapply(ratings, function(x){x$getElementText()}))
I get NULL. I think the reason is that the rating is actually a image. I paste a small part of the page source here:
<div class="review-content">
<div class="review-content">
<div class="biz-rating biz-rating-very-large clearfix">
<div>
<div class="rating-very-large">
<i class="star-img stars_2" title="2.0 star rating">
<img alt="2.0 star rating" class="offscreen" height="303" src="//s3-media4.fl.yelpcdn.com/assets/srv0/yelp_styleguide/c2252a4cd43e/assets/img/stars/stars_map.png" width="84">
</i>
</div>
</div>
Basically, if I can extract the text from class="stat-img stars_2" or title="2.0 star rating" then I am good. Can anyone help me on this?