fun findComponent()

in robot-server-core/src/main/kotlin/com/intellij/remoterobot/services/xpath/XpathSearcher.kt [15:23]


    fun findComponent(xpathExpression: String, component: Component?): Component {
        val components = findComponents(xpathExpression, component)
        if (components.size > 1) {
            throw IllegalStateException("To many components found by xpath '$xpathExpression'")
        } else if (components.isEmpty()) {
            throw IllegalStateException("No components found by xpath '$xpathExpression'")
        }
        return components.first()
    }