美文网首页
katalon stale element reference:

katalon stale element reference:

作者: 红了白 | 来源:发表于2019-12-03 10:47 被阅读0次

import java.util.logging.Logger

import com.kms.katalon.core.webui.driver.DriverFactory

public Boolean isDisplay(TestObject to, final String text) {

String path = to.getSelectorCollection().get(SelectorMethod.XPATH)

Logger logger = Logger.getLogger("InfoLogging");

logger.info("wait add to cart mes display");

boolean result = false;

int attempts = 0;

while (attempts < 5) {

try {

attempts++;

logger.info("scan" + attempts + "time(s)");

result = new WebDriverWait(driver, 30)

.until(new ExpectedCondition<Boolean>() {

public Boolean apply(WebDriver driver) {

return driver.findElement(By.xpath(path)).getText().contains(text);

}

});

logger.info("scan end");

return true;

} catch (Exception e) {

e.printStackTrace();

}

}

return result;

}

相关文章

网友评论

      本文标题:katalon stale element reference:

      本文链接:https://www.haomeiwen.com/subject/ziqcgctx.html