1 2 3 4 5 6 7 | require 'appium_lib' caps = { caps: { platformName: 'Android', appActivity: '.Calculator', appPackage: 'com.android.calculator2' }, appium_lib: { sauce_username: nil, sauce_access_key: nil, debug: true} } dr = Appium::river.new(caps).start_driver dr.find_element(id: 'com.android.calculator2:id/digit9').click |
01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 | #coding:utf-8 from appium import webdriver from time import sleep desired_caps = {} desired_caps['platformName'] = 'Android' desired_caps['platformVersion'] = '4.4' desired_caps['deviceName'] = 'Android Emulator' desired_caps['app'] = 'Calculator.apk' desired_caps['appPackage'] = 'com.android.calculator2' desired_caps['appActivity'] = '.Calculator' dr = webdriver.Remote('[color=rgb(42, 0, 255) !important]http://localhost:4723/wd/hub', desired_caps) sleep(3) dr.find_element_by_id('com.android.calculator2:id/digit9').click() |
01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | //新建一个FindById类位于info.itest.www package下面 package info.itest.www; import io.appium.java_client.AppiumDriver; import java.net.MalformedURLException; import java.net.URL; import org.openqa.selenium.remote.CapabilityType; import org.openqa.selenium.remote.DesiredCapabilities; public class FindById { public static void main(String args[]) throws MalformedURLException { DesiredCapabilities cap = new DesiredCapabilities(); cap.setCapability(CapabilityType.BROWSER_NAME, ""); cap.setCapability("platformName", "Android"); cap.setCapability("deviceName", "Android Emulator"); cap.setCapability("platformVersion", "4.4"); cap.setCapability("appPackage", "com.android.calculator2"); cap.setCapability("appActivity", ".Calculator"); AppiumDriver dr = new AppiumDriver(new URL("[color=rgb(42, 0, 255) !important]http://127.0.0.1:4723/wd/hub"), cap); dr.findElement(By.id("com.android.calculator2:id/digit9")).click(); } } |
啦啦啦啦哈 发表于 2017-7-12 17:22
很详细啊,谢谢啦!
啦啦啦啦哈 发表于 2017-7-12 17:22
很详细啊,谢谢啦!
欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) | Powered by Discuz! X3.2 |