Appium: “An element could not be located on the page using the given search parameters” error

后端 未结 3 1680
遥遥无期
遥遥无期 2021-01-11 17:13

I am new to Appium and have been trying to automate the Conversion Calculator app for Android. Am getting the error \"org.openqa.selenium.NoSuchElementException: An element

相关标签:
3条回答
  • 2021-01-11 17:58

    Possible Cause:

    • Multiple EditText in the current screen.

    Please try with the following:

    Solution1:

    List<WebElement> editText = driver.findElements(By.className("android.widget.EditText"));
    editText.get(0).sendKeys("123");
    

    0 - Index of EditText

    Solution2:

    Use any other locating strategy like Xpath.

    0 讨论(0)
  • 2021-01-11 18:04

    I would use driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); instead of Thread.sleep(5000).

    Try to use a newer version of Appium, I's been improved a lot. You can download the latest version of Appium and Appium clients here:http://appium.io/downloads.html

    But be careful because in the newer version the findElement throws an Exception if there are more then one result of the search.


    I would write this in a comment but I've not enough reputation :/

    0 讨论(0)
  • 2021-01-11 18:12

    Maybe you could try waiting until the element is visible or enabled using a WebDriverWait object?

    0 讨论(0)
提交回复
热议问题