您好,登錄后才能下訂單哦!
本篇內容主要講解“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:4723
Maven dependency
<dependency>
<groupId>io.appium</groupId>
<artifactId>java-client</artifactId>
<version>4.1.2</version>
</dependency>
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<MobileElement> driver =
new AndroidDriver<MobileElement>(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如何安裝配置環境”有了更深的了解,不妨來實際操作一番吧!這里是億速云網站,更多相關內容可以進入相關頻道進行查詢,關注我們,繼續學習!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。