Class AndroidCapability
java.lang.Object
core.uiCore.driverProperties.capabilities.AndroidCapability
- Author:
- ehsan.matean
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongets the list of android devices including real devices + emulators skips the first item, as it is not a deviceorg.openqa.selenium.remote.DesiredCapabilitiesgetRealDevices(List<String> devices) gets the name of the first real device connectedbooleanif adb device contains emulator, Then its an emulator otherwise, its a connected real devicestatic voidstatic voidorg.openqa.selenium.remote.DesiredCapabilitiesset capabilties with prefix android.capabilties.voidsets device by following strategy: if device is connected, selects device if emulator is not specified with "withDevice1() or with Device2() function, select device 1 by default from properties else select emulator from properties specified in panel config pagestatic voidsets the value for android home based on its default location sets android home based on user.home location on mac checks if the generated android home location exists, if true, adds to android.home config valuevoiddownload chrome driver if hybrid app is enabled if Version is LATEST, download latest driver unless set in configvoidif device has port assigned, use assigned port else generate new port numbervoidsets real devicevoidsets ios device number of devices must be equal or greater than number of threads for parallel runvoidruns subsequent tests without restarting the app removes the need to sign in on every test if tests fail, it will restart the appstatic voiduninstalls the uiautomator2 server only runs the first time android test is run a device or emulator must be connectedsets android capabilities values are from maven or properties file maven has higher priority than propertieswithCapability(org.openqa.selenium.remote.DesiredCapabilities Capabilities) withDevice(String device) device: property name from property file.
-
Field Details
-
capabilities
public org.openqa.selenium.remote.DesiredCapabilities capabilities -
APP_DIR_PATH
-
APP_NAME
-
ANDROID_ENGINE
-
UIAUTOMATOR2
-
ANDROID_INIT
public static boolean ANDROID_INIT -
ANDROID_HOME
-
ANDROID_UDID
-
IS_HYBRID_APP
-
CHROME_VERSION
-
simulatorList
-
SYSTEM_PORT
public static int SYSTEM_PORT
-
-
Constructor Details
-
AndroidCapability
public AndroidCapability()
-
-
Method Details
-
withCapability
public AndroidCapability withCapability(org.openqa.selenium.remote.DesiredCapabilities Capabilities) -
withDevice
device: property name from property file. eg. device1, device2- Parameters:
device-- Returns:
-
getCapability
public org.openqa.selenium.remote.DesiredCapabilities getCapability() -
getAppPath
-
withAndroidCapability
sets android capabilities values are from maven or properties file maven has higher priority than properties- Returns:
-
setAndroidCapabilties
public org.openqa.selenium.remote.DesiredCapabilities setAndroidCapabilties()set capabilties with prefix android.capabilties. eg. android.capabilties.fullReset="false iterates through all property values with such prefix And adds them to android desired capabilities- Returns:
-
setChromeDriver
public void setChromeDriver()download chrome driver if hybrid app is enabled if Version is LATEST, download latest driver unless set in config -
setSingleSignIn
public void setSingleSignIn()runs subsequent tests without restarting the app removes the need to sign in on every test if tests fail, it will restart the app -
isRealDeviceConnected
public boolean isRealDeviceConnected()if adb device contains emulator, Then its an emulator otherwise, its a connected real device- Parameters:
devices-- Returns:
-
getRealDevices
gets the name of the first real device connected- Parameters:
devices-- Returns:
-
getAndroidDeviceList
gets the list of android devices including real devices + emulators skips the first item, as it is not a device- Returns:
- device list
-
getAndroidRealDeviceList
-
setSimulator
public void setSimulator()sets ios device number of devices must be equal or greater than number of threads for parallel run -
setPort
if device has port assigned, use assigned port else generate new port number- Parameters:
deviceName-
-
restartAdb
public static void restartAdb() -
uninstallUiAutomator2
public static void uninstallUiAutomator2()uninstalls the uiautomator2 server only runs the first time android test is run a device or emulator must be connected -
setRealDevices
public void setRealDevices()sets real device -
setAndroidDevice
public void setAndroidDevice()sets device by following strategy: if device is connected, selects device if emulator is not specified with "withDevice1() or with Device2() function, select device 1 by default from properties else select emulator from properties specified in panel config page -
printAndroidHelp
-
setAndroidHome
public static void setAndroidHome()sets the value for android home based on its default location sets android home based on user.home location on mac checks if the generated android home location exists, if true, adds to android.home config value
-