I need to get the ratings(stars) of a particular company using Xpath .Below is the block of div element from which I need to decide if its a 5 star , 4 star , 3 star etc depending the class attribute
div class="star-rating star-rating-4 star-rating--medium" div
"star-rating star-rating-4 star-rating--medium" , if this is class with 4 star rating I need to return 4 , 5 if its a 5 star rating and so on .One way I can do this is try to get Xpath of all variants(3,4,5 star rating) and whichever doesn't turn up as null return that .Is there any better way to achieve this ?
Here is the xpath Based on the class of div:
OutPut: 4
Based on index of the rating div:
This will return the rating of 2nd div with class name that starts with
star-rating star-rating-