2016-08-25 103 views
0

关于驱动自动化Android应用我使用AppiumDriver移动应用自动化

AppiumDriver driver = new AppiumDriver(new URL("http://localhost:5555/wd/hub"), capabilities); 

我已经在网络使用RemoteWebDriver

RemoteWebDriver driver = new RemoteWebDriver(new URL("http://localhost:5555/wd/hub"), capabilities); 

是否有任何需要使用不同的驱动程序中。如果是的话,对于automationg iOS应用程序,我需要使用哪个驱动程序?

回答

1

驱动程序的使用方式有多种可能性,区别在于您希望提供多少平台特定的功能。

对于Android,最具体的驱动程序将是AndroidDriver。 AndroidDriver扩展了AppiumDriver(你现在使用的那个),AppiumDriver扩展了RemoteWebDriver。换句话说,RemoteWebDriver具有最少的功能,并且通过驱动程序可以带来更多选择。

Java的客户端的AndroidDriver:如出现在API文档页面AndroidDriver的 http://appium.github.io/java-client/io/appium/java_client/android/AndroidDriver.html

继承:

java.lang.Object 
    org.openqa.selenium.remote.RemoteWebDriver 
    io.appium.java_client.AppiumDriver<T> 
     io.appium.java_client.android.AndroidDriver<T> 

注意AppiumDriver和AndroidDriver包括<牛逼>,它允许您选择什么您正在使用的MobileElements类型。访问驱动程序的所有Android特定功能,您可能要定义<牛逼>到<AndroidElement>:http://appium.github.io/java-client/io/appium/java_client/android/AndroidElement.html

AndroidElement的继承:

java.lang.Object 
    org.openqa.selenium.remote.RemoteWebElement 
    io.appium.java_client.MobileElement 
     io.appium.java_client.android.AndroidElement 

iOS版也同样IOSDriver:http://appium.github.io/java-client/io/appium/java_client/ios/IOSDriver.html 随着继承:

java.lang.Object 
    org.openqa.selenium.remote.RemoteWebDriver 
    io.appium.java_client.AppiumDriver<T> 
     io.appium.java_client.ios.IOSDriver<T> 

在许多情况下,仅仅使用AppiumDriver和0123一起就足够了WebElement >(这被缺省使用)或<MobileElement>

+0

我们可以使用AppiumDriver与出

+1

一些元素类型总是在使用中。如果你没有定义它,WebElement默认会被使用。您可以在Android/iOS应用程序自动化中使用WebElements,但使用更少的功能来操作元素。 – Domestus