Appium如何安装配置环境-创新互联
本篇内容主要讲解“Appium如何安装配置环境”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“Appium如何安装配置环境”吧!
为娄烦等地区用户提供了全套网页设计制作服务,及娄烦网站建设行业解决方案。主营业务为成都网站建设、网站建设、娄烦网站设计,以传统方式定制建设网站,并提供域名空间备案等一条龙服务,秉承以专业、用心的态度为用户提供真诚的服务。我们深信只要达到每一位用户的要求,就会得到认可,从而选择与我们长期合作。这样,我们也可以走得更远!安装Android SDK,AndroidSDK_installer_r24.4.1-windows.exe
用Admistrator运行"SDK Manager.exe",
Tools 下选择SDK Tools, SDK Platform-tools, SDK Build-tools 安装
Android 7.11 (API 25) 下选择 SDK Platform 安装
Android 5.1.1 (API 22) 下选择 SDK Platform,ARM EABI v7a System Image和Intel x86 Atom System Image 安装
这个可以自己选择安装。用Administrator 运行"AVD Manager.exe"
在Device Definitions 下选择 Nexus 4然后点Create Device,输入名字,屏幕大小,分辨率,内存大小。
在Device Definitions 下选择刚才新建的Device,然后点击Create AVD 创建虚拟设备, CPU/ABI 选择 ARM (armeabi-v7a), Skin 选 No Skin
在Android Virtual Devices下 选择金健的虚拟设备,点Start, 启动设备添加环境变量 ANDROID_HOME=C:\Program Files (x86)\Android\android-sdk
安装 nodejs
nodejs 下安装 appium
npm install -g appium
npm install -g appium-doctor运行 appium-doctor, 检查环境
info AppiumDoctor Appium Doctor v.1.4.2
info AppiumDoctor ### Diagnostic starting ###
info AppiumDoctor ? The Node.js binary was found at: C:\Program Files\nodejs\node.exe
info AppiumDoctor ? Node version is 6.10.2
info AppiumDoctor ? ANDROID_HOME is set to: C:\Program Files (x86)\Android\android-sdk
info AppiumDoctor ? JAVA_HOME is set to: C:\Program Files\Java\jdk1.8.0_51
info AppiumDoctor ? adb exists at: C:\Program Files (x86)\Android\android-sdk\platform-tools\adb.exe
info AppiumDoctor ? android exists at: C:\Program Files (x86)\Android\android-sdk\tools\android.bat
info AppiumDoctor ? emulator exists at: C:\Program Files (x86)\Android\android-sdk\tools\emulator.exe
info AppiumDoctor ? Bin directory of %JAVA_HOME% is set
info AppiumDoctor ### Diagnostic completed, no fix needed. ###
info AppiumDoctor
info AppiumDoctor Everything looks good, bye!
info AppiumDoctor运行appium, 启动appium hub server
C:\Program Files\nodejs>appium
[Appium] Welcome to Appium v1.6.4
[Appium] Appium REST http interface listener started on 0.0.0.0:4723Maven dependency
io.appium java-client 4.1.2 Java
import java.net.URL;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
import io.appium.java_client.MobileElement;
import io.appium.java_client.android.AndroidDriver;
public class AndroidDriverTest {
public static void main(String[] args) throws Exception {
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(CapabilityType.BROWSER_NAME, "");
capabilities.setCapability("platformName", "Android");
capabilities.setCapability("deviceName", "Android Emulator");
capabilities.setCapability("platformVersion", "5.1.1");
capabilities.setCapability("appPackage", "com.android.calculator2");
capabilities.setCapability("appActivity", ".Calculator");
AndroidDriver
driver = new AndroidDriver
(new URL("http://127.0.0.1:4723/wd/hub"), capabilities); driver.findElementByAndroidUIAutomator("text(\"1\")").click();
driver.findElementByAndroidUIAutomator("text(\"+\")").click();
driver.findElementByAndroidUIAutomator("text(\"2\")").click();
driver.findElementByAndroidUIAutomator("text(\"=\")").click();
System.out.println(driver.currentActivity());
driver.quit();
}
}
到此,相信大家对“Appium如何安装配置环境”有了更深的了解,不妨来实际操作一番吧!这里是创新互联网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!
分享题目:Appium如何安装配置环境-创新互联
浏览路径:http://ybzwz.com/article/pjhcg.html