-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
Open
Labels
C-javaJava BindingsJava BindingsI-defectSomething is not working as intendedSomething is not working as intendedI-regressionSomething was working but we "fixed" itSomething was working but we "fixed" it
Milestone
Description
Description
This used to compile in 4.39.0, then in 4.40.0 the annotations were added and it triggered this problem: #16970, the fix to that problem looks like it caused this one. Note: I acknowledge this might be a Kotlin compiler issue, I can't decide. Happy to forward the issue if you can help me figure out what's causing it that you can't help with some more/less annotations.
The problem on .until can be "fixed" by .until<WebElement>(…), but that shouldn't be needed either. For the parameter to until I found no workaround other than lying about the type:
.until(ExpectedConditions.…(…) as ExpectedCondition<WebElement>) + @Suppress("UNCHECKED_CAST").
Reproducible Code
fun WebDriver.wait(): WebDriverWait =
WebDriverWait(this, 30.seconds.toJavaDuration())
fun WebDriver.delayedExecute(locator: By, action: (WebElement) -> Unit) {
val element = this.wait().until(ExpectedConditions.presenceOfElementLocated(locator))
this.wait().until(ExpectedConditions.visibilityOf(element))
action(element)
}Debugging Logs
e: file:///.../wait.kt:38:28 [CANNOT_INFER_PARAMETER_TYPE] Cannot infer type for type parameter 'V'. Specify it explicitly.
e: file:///.../wait.kt:38:34 [ARGUMENT_TYPE_MISMATCH] Argument type mismatch: actual type is 'ExpectedCondition<WebElement?>', but 'Function<in WebDriver, uninferred V! (of fun <V : Any> until)>' was expected.
e: file:///.../wait.kt:39:14 [CANNOT_INFER_PARAMETER_TYPE] Cannot infer type for type parameter 'V'. Specify it explicitly.
e: file:///.../wait.kt:39:20 [ARGUMENT_TYPE_MISMATCH] Argument type mismatch: actual type is 'ExpectedCondition<WebElement?>', but 'Function<in WebDriver, uninferred V! (of fun <V : Any> until)>' was expected.
ℹ️ Last known working version: 4.40.0
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
C-javaJava BindingsJava BindingsI-defectSomething is not working as intendedSomething is not working as intendedI-regressionSomething was working but we "fixed" itSomething was working but we "fixed" it