JavaApp自动化测试系列[v1.0.0][Appium Inspector元素定位]

Finding elements by xpath

在这里插入图片描述
WebElement digit_9 = driver.findElement(By.xpath("//android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.support.v4.view.viewPager[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[1]/android.widget.Button[3]"));

Finding elements by name

在这里插入图片描述
WebElement editBox = driver.findElement(By.name("IntegerB"));

Finding elements by IosUIAutomation

findElements(By.IosUIAutomation(String IosUIAuto));
 
//这个方法会返回一个元素的数组,我们需要通过索引定位到唯一的元素,例如
 
WebElement editBox = driver.findElements(By.IosUIAutomation(".elements()[0]"));
 
WebElement editBox = driver.findElements(By.IosUIAutomation(".textFields()[0]"));

猜你喜欢

转载自blog.csdn.net/dawei_yang000000/article/details/108169777