我正在尝试在 Katalon(使用 Groovy)中执行显式等待。我有以下代码:
// wait on page change to "Dashboard"
WebDriverWait dashboardChangeWait = new WebDriverWait(driver, 3)
/* This is causing the following Exception :
* - GroovyCastException : Attempt to cast 'true' with class 'java.lang.Boolean' to class
* 'org.openqa.selenium.WebElement'
* */
WebElement element = dashboardChangeWait.until(
ExpectedConditions.textToBe(By.cssSelector('.breadcrumb-item.active'), "DASHBOARD"))
这给了我一个GroovyCastException. 我知道这WebDriverWait.until需要一个Function(耶,类似 JavaScript 的编码!)参数,并且ExpectedConditions.textToBe 返回 aExpectedCondition<Boolean>和until的签名是V org.openqa.selenium.support.ui.FluentWait.until(Function<Object, Object<V>> arg0). 有没有办法在 Katalon 中执行这种等待,从而避免这个问题?