【发布时间】:2022-04-21 08:21:14
【问题描述】:
提前谢谢你!
我需要将鼠标悬停在星星上并选择第 5 颗星星。
请找到我的代码:-
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();
}
}
【问题讨论】:
-
请记得标记帮助您解决问题的答案。见stackoverflow.com/help/someone-answers