Search code examples
kotlinappiumselenide

Element not found for Input elements on Selenide + Appium


I'm writing Android Web automated test using Kotlin+Selenide+Appium. There's already working Desktop Web version of those tests on Kotlin+Selenide.

Koltin 1.2.31 Selenide:4.11.1 Appium:java-client:5.0.4 Appium: 1.7.2

Test starts, appium server starts, browser on my device starts, page opens, element is located but it cannot setValue for it. Test works well except for Input elements and manipulations on it.

In test, I clear the field at first, then I set value for it. It actually find the element, clears it and then throws the error on that step (clear the field). So it clears the field but it also cannot found it??? Errors that appear:

Element not found {.project-scope-main-header-content-input > div > input} Expected: exist

Caused by: WebDriverException: unknown error: call function result missing 'value'

I tried to run the tests with and without these 2 capabilities:

capa.setCapability("unicodeKeyboard", true)

capa.setCapability("resetKeyboard", true)

Appreciate any help. Thanks.

EDIT: The problem is in outdated ChromeDriver which I cannot update for some reasons.

EDIT#2: Here's how I initialize it: `

lateinit var driver: AppiumDriver<SelenideElement>
private val appiumServer = AppiumRunAndStop()

@BeforeClass
@Parameters("platform")
fun setUp(platform : String) {
    appiumServer.restartServer()
    when (platform) {
        "Android" -> {
            val capa = DesiredCapabilities()
            capa.setCapability("automationName", "Appium")
            //capa.setCapability("newCommandTimeout", 150)
            capa.setCapability("platformName", "Android")
            capa.setCapability("platformVersion", "8.1.0")
            capa.setCapability("deviceName", "Nexus 6P")
            capa.setCapability("browserName", "Chrome")
            capa.setCapability("unicodeKeyboard", true)
            capa.setCapability("resetKeyboard", true)
            capa.setCapability("chromedriverExecutable", "pathh\\chromedriver_win32\\chromedriver.exe")
            driver = AppiumDriver(URL("http://127.0.0.1:4723/wd/hub"), capa)
            sleep(2000)
            WebDriverRunner.setWebDriver(driver)

        }
        "iOS" -> {
            //TO DO
        }
        else -> println("Platform is not correct")
    }
    Configuration.baseUrl = "my_url"
}`

It works with this capa.setCapability("chromedriverExecutable", "pathh\\chromedriver_win32\\chromedriver.exe") but I want it to autoupdate the ChromeDriver automatially.


Solution

  • I found the problem. My test uses outdated ChromeDriver (chromedriver=2.33.506120).

    I don't know how to update it for this test. WebDriverManager.chromedriver().version("2.37").setup() doesn't help. System.setProperty("webdriver.chrome.driver","path\\chromedriver_win32\\chromedriver.exe") either doesn't help.

    I also tried to do this:

    val options = ChromeOptions()
    options.addArguments("androidPackage", "com.android.chrome")
    capa.setCapability(ChromeOptions.CAPABILITY, options)`
    

    EDIT: Worked with capa.setCapability("chromedriverExecutable", "PATH") but why Selenide doesn't update ChromeDriver by itself?