1 回答

TA贡献1796条经验 获得超4个赞
我试图更改对象属性,它现在工作。
我使用cssValues而不是检查对象是否存在。
以下是上一个的变化...圈。
感谢大家研究这个问题。
//WebElement hoveredPortion = DriverUtils.getDriver().findElement(By.xpath("(*//div[@data-index = '" + dataIndex + "']/descendant::div//*[contains(@class, 'mli-donut-chart')]//*[contains(@transform,'translate')]//*[contains(@style,'fill-opacity: 0.3')])["+ y +"]"));
String notHoveredPortion = DriverUtils.getDriver().findElement(By.xpath("*//div[@data-index = '"+ dataIndex +"']/descendant::div//*[contains(@class, 'mli-donut-chart')]//*[contains(@transform,'translate')]//*[contains(@style,'fill-opacity')]")).getCssValue("fill-opacity");
System.out.println("value of fill-opacity: " +notHoveredPortion);
//if(hoveredPortion!=null) {
if(notHoveredPortion.equals("0.3")) {
Reporter.log("Passed: allocation #: " + b, MessageTypes.Pass);
} else {
Reporter.log("Failed", MessageTypes.Fail);
}
添加回答
举报