Can we find element by ID in appium

前端 未结 6 700
野的像风
野的像风 2020-12-09 04:13

following link mentions that we can find element by giving id... but i am unable to find it.

https://github.com/appium/appium/blob/master/docs/en/writing-running-app

6条回答
  •  攒了一身酷
    2020-12-09 04:33

    Here is the jave code with most common ways to locate elements using Appium

    //Find element by id and enter Hello in Text box.
    
        driver.findElementById("edit_name").sendKeys("Hello");
        //Find element by class name and enter Hello in Text box.
    
         driver.findElementByClassName("com.android.EditText").sendKeys("Hello");
        //Find element by xpath and enter Hello in Text box.
    
        driver.findElementByXPath("//cass[@value='Enter Name']").sendKeys("Hello");
        //Find element by link text and enter Hello in Text box.
    
        driver.findElementByLinkText("Enter Name").sendKeys("Hello");
    

    If you want to learn more ways to find elements in appium for native and webviews VISIT HERE

提交回复
热议问题