WebDriverWait wait = new WebDriverWait(driver, 15);
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//a[contains(.,'"+eventname+"')])")));
WebElement editeve = driver.findElement(By.xpath("//a[contains(.,'"+eventname+"')])"));
//driver.findElement(By.xpath("//a[contains(.,'abc2016Feb11ab')]"));
Actions actions = new Actions(driver);
actions.moveToElement(editeve);
actions.perform();
editeve.click();
答案 0 :(得分:0)
如果syso的值很好,那么创建一个字符串。首先连接xpath的所有值,然后将其传递给元素
String xpathOfEvent ="//a[contains(.,'"+eventname+"')])";
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(xpathOfEvent)));
我假设您的定位器很好并且能够找到元素
希望它会对你有所帮助:)。