javaseleniumtripadvisor

How to handle the ratings within bubble rating widget with in Tripadvisor?


I hava a scenario in which i need to click fifth bubble of bubble rating widget within tripadvisor

The HTML code is:

<span id="bubble_rating" class="ui_bubble_rating fl bubble_10" data-value="1" onclick="ta.userreview.common.trackFieldFocus(this); ">
<img src="https://static.tacdn.com/img2/x.gif" alt="Roll over, then click to rate">
</span>

I am trying with below code snippet:

Actions action = new Actions(driver);
WebElement element = driver.findElement(By.xpath("//span[@id='bubble_rating']"));
action.moveToElement(element).perform();

This code hovers only first 3 bubbles and rest 4th,5th are not being clicked.


Solution

  • To click for all the 5 star ratings within the Bubble Rating widget in https://www.tripadvisor.in/ using Selenium you have to induce WebDriverWait for the visibilityOfElementLocated() and you can use either of the following Locator Strategies:

    bubble_rating_widget