katalon stale element reference: element is not attached to the page document

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() {

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: element is not attached to the page document)