Mac环境下使用Appium Inspector进行元素定位

 一、摘要

本篇博文介绍在Mac系统上使用AppiumI Inspector进行App页面元素定位

二、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]"));

猜你喜欢

转载自www.cnblogs.com/davieyang/p/10063590.html