Android應用程式測試-Alltesting|澤眾雲測試

fangminhe發表於2022-06-06

用於 Android 應用程式測試的示例 Java 測試指令碼

為了讓您開始,這裡有一個示例 Java 測試指令碼,用於使用 Appium 進行 Android 測試。

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
import io.appium.java_client.android.AndroidDriver;
import java.net.URL;

public class SampleSauceCheckBoxTest {

 public static final String USERNAME = "YOUR_USERNAME";
 public static final String ACCESS_KEY = "YOUR_ACCESS_KEY";
 public static final String URL = " + USERNAME + ":" + ACCESS_KEY + "@ondemand.saucelabs.com:443/wd/hub";

 public static void main(String[] args) throws Exception {

   DesiredCapabilities capabilities = new DesiredCapabilities();
   capabilities.setCapability("platformName", "Android");
   capabilities.setCapability("deviceName", "Samsung Galaxy S4 Emulator");
   capabilities.setCapability("platformVersion", "4.4");
   capabilities.setCapability("app", ");
   capabilities.setCapability("browserName", "");
   capabilities.setCapability("deviceOrientation", "portrait");
   capabilities.setCapability("appiumVersion", "1.5.3");

   WebDriver driver = new AndroidDriver<>(new URL(URL), capabilities);

   /**
    * Test Actions here...
    */

   driver.quit();
 }
}



推薦閱讀:

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/31387097/viewspace-2898913/,如需轉載,請註明出處,否則將追究法律責任。

相關文章