Quantcast
Channel: Active questions tagged selenium - Stack Overflow
Viewing all articles
Browse latest Browse all 97773

Unable to find the xpath of star using selenium & java

$
0
0

Thank you in advance !

url - https://www.tripadvisor.in/UserReviewEdit-g641714-d1156207-Club_Mahindra_Madikeri_Coorg-Madikeri_Kodagu_Coorg_Karnataka.html

i need to hover on the stars and select the 5th star.

please find my code :-

private static void setRating(String star) {
        //new Actions(driver).moveToElement(driver.findElement(By.xpath("//*[@id='qid10']/option[1]"))).perform();
        List<WebElement> rating = driver.findElements(By.xpath("//span[@class='ui_bubble_rating fl bubble_00']"));
        rating.size();

        List<WebElement> ele = driver.findElements(By.xpath("//div[@class='easyClear bigRatingParent']"));
        System.out.println(ele.size());
        for(WebElement ratings:ele) {
            System.out.println(ratings);
        }
        new Actions(driver).moveToElement(driver.findElement(By.xpath("//div[@class='question rating bigRating labelAndInput required  ']/child::label/following-sibling::div/child::span"))).perform();
        driver.findElement(By.xpath("//*[@id='qid10']/option[6]")).click();

    }
}

Viewing all articles
Browse latest Browse all 97773

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>