How to use setDeviceParameters method of com.paypal.selion.internal.platform.grid.MobileTestSession class

Best SeLion code snippet using com.paypal.selion.internal.platform.grid.MobileTestSession.setDeviceParameters

Source:MobileTestSession.java Github

copy

Full Screen

...133 appLanguage = getLocalConfigProperty(ConfigProperty.MOBILE_APP_LANGUAGE);134 }135 if (StringUtils.isNotBlank(getLocalConfigProperty(ConfigProperty.MOBILE_DEVICE))) {136 String device = getLocalConfigProperty(ConfigProperty.MOBILE_DEVICE);137 setDeviceParameters(device);138 }139 if (StringUtils.isNotBlank(getLocalConfigProperty(ConfigProperty.MOBILE_DEVICE_TYPE))) {140 deviceType = getLocalConfigProperty(ConfigProperty.MOBILE_DEVICE_TYPE);141 }142 if (StringUtils.isNotBlank(getLocalConfigProperty(ConfigProperty.ANDROID_APP_MAIN_ACTIVITY))) {143 androidAppMainActivity = getLocalConfigProperty(ConfigProperty.ANDROID_APP_MAIN_ACTIVITY);144 }145 if (StringUtils.isNotBlank(getLocalConfigProperty(ConfigProperty.ANDROID_APP_PACKAGE))) {146 androidAppPackage = getLocalConfigProperty(ConfigProperty.ANDROID_APP_PACKAGE);147 }148 149 if (StringUtils.isNotBlank(getLocalConfigProperty(ConfigProperty.BROWSER))) {150 browserName = getLocalConfigProperty(ConfigProperty.BROWSER);151 }152 // Override values when supplied via the annotation153 if (deviceTestAnnotation != null) {154 if (StringUtils.isNotBlank(deviceTestAnnotation.appName())) {155 this.appName = deviceTestAnnotation.appName();156 }157 if (StringUtils.isNotBlank(deviceTestAnnotation.language())) {158 this.appLanguage = deviceTestAnnotation.language();159 }160 if (StringUtils.isNotBlank(deviceTestAnnotation.locale())) {161 this.appLocale = deviceTestAnnotation.locale();162 }163 if (StringUtils.isNotBlank(deviceTestAnnotation.device())) {164 setDeviceParameters(deviceTestAnnotation.device());165 }166 if (StringUtils.isNotBlank(deviceTestAnnotation.deviceSerial())) {167 this.deviceSerial = deviceTestAnnotation.deviceSerial();168 }169 if (StringUtils.isNotBlank(deviceTestAnnotation.deviceType())) {170 this.deviceType = deviceTestAnnotation.deviceType();171 }172 if (StringUtils.isNotBlank(deviceTestAnnotation.appPath())) {173 this.appPath = deviceTestAnnotation.appPath();174 }175 if (StringUtils.isNotBlank(deviceTestAnnotation.mobileNodeType())) {176 mobileNode = deviceTestAnnotation.mobileNodeType();177 }178 if (StringUtils.isNotBlank(deviceTestAnnotation.browserName())) {179 this.browserName = deviceTestAnnotation.browserName();180 }181 this.mobileNodeType = MobileNodeType.getMobileNodeType(mobileNode);182 initializeAdditionalCapabilities(method);183 initializeAdditionalCapabilities(deviceTestAnnotation.additionalCapabilities());184 initializeAdditionalCapabilities(deviceTestAnnotation.additionalCapabilitiesBuilders());185 }186 boolean appPathProvided = StringUtils.isNotBlank(appPath);187 188 //App run and browser run should be mutually exclusive. If appName or appPath is provided disregard189 //the browser parameter190 if(StringUtils.isNotBlank(appName) || StringUtils.isNotBlank(appPath)){191 this.browserName = ""; //to nullify the default value *firefox192 }193 checkArgument(!(mobileNodeType != MobileNodeType.APPIUM && appPathProvided),194 "appPath can be specified for appium only, Please specify appName instead of appPath");195 checkArgument(196 StringUtils.isNotBlank(appName) ^ StringUtils.isNotBlank(appPath) ^ StringUtils.isNotBlank(browserName),197 "Either you have provided appPath, appName, and browserName all at once or you have specified nothing. "198 + "Please specify one of appPath, appName, or browserName");199 checkArgument(isDeviceDefined(),200 "The device should either be provided as 'device name:version' or 'device' or 'device:version'." +201 " like 'iphone', 'ipad', 'iphone:7.1', 'android', 'nexus 5:17', 'android:18', etc.");202 // appName can be passed via the annotation or as a config var. It may contain precision info.203 if (StringUtils.contains(this.appName, ":")) {204 String[] appNames = StringUtils.split(this.appName, ":");205 appVersion = appNames[1];206 appName = appNames[0];207 }208 // appPath can be passed via the annotation or as a config var. It may need formatting.209 if (appPathProvided && this.appPath.startsWith(SELION_HUB_STORAGE)) {210 // parse and construct the absolute url for selion hub storage211 this.appPath = getSelionHubStorageUrl(this.appPath);212 } else if (appPathProvided && !this.appPath.startsWith(SAUCE_URL) && !StringUtils.startsWithIgnoreCase(appPath, "http")) {213 // construct the absolute url for apps exist in resource folder.214 Path p = Paths.get(appPath);215 if (!p.isAbsolute()) {216 this.appPath = String.format("%s/%s", System.getProperty("user.dir"), appPath);217 }218 }219 this.platform = WebDriverPlatform.ANDROID;220 if (IPHONE.equalsIgnoreCase(getDevice()) || IPAD.equalsIgnoreCase(getDevice())) {221 this.platform = WebDriverPlatform.IOS;222 }223 logger.exiting();224 }225 private void setDeviceParameters(String device) {226 String deviceName;227 String[] devices = StringUtils.split(device, ":");228 boolean mobileDeviceContainsbothNameAndVersion = devices.length > 1;229 if (mobileDeviceContainsbothNameAndVersion) {230 this.platformVersion = devices[1];231 deviceName = devices[0];232 } else if (device.indexOf(':') == 0) {233 this.platformVersion = devices[0];234 deviceName = "";235 } else {236 deviceName = devices[0];237 }238 deviceName = deviceName.trim();239 this.device =...

Full Screen

Full Screen

setDeviceParameters

Using AI Code Generation

copy

Full Screen

1setDeviceParameters("HTC One M8", "Android", "4.4.2")2setDeviceParameters("iPhone 6", "iOS", "8.1")3setDeviceParameters("Lumia 950", "Windows", "10")4setDeviceParameters("Lumia 950", "Windows", "8.1")5setDeviceParameters("Lumia 950", "Windows Phone", "8.1")6setDeviceParameters("BlackBerry Z10", "BlackBerry", "10.2.1.3247")7setDeviceParameters("Firefox OS Emulator", "Firefox OS", "1.3")8setDeviceParameters("Galaxy Gear", "Tizen", "2.3")9setDeviceParameters("Mac OS", "Mac OS", "10.10")10setDeviceParameters("Chrome OS", "Chrome OS", "53.0.2785.101")11setDeviceParameters("Linux", "Linux", "3.13.0-92-generic")12setDeviceParameters("Ubuntu", "Ubuntu", "14.04")

Full Screen

Full Screen

setDeviceParameters

Using AI Code Generation

copy

Full Screen

1setDeviceParameters("iPhone 6", "8.3")2setDeviceParameters("Samsung Galaxy S5", "4.4")3setDeviceParameters("iPhone 6", "8.3")4setDeviceParameters("Samsung Galaxy S5", "4.4")5setDeviceParameters("iPhone 6", "8.3")6setDeviceParameters("Samsung Galaxy S5", "4.4")7setDeviceParameters("iPhone 6", "8.3")8setDeviceParameters("Samsung Galaxy S5", "4.4")

Full Screen

Full Screen

setDeviceParameters

Using AI Code Generation

copy

Full Screen

1public static void setDeviceParameters() {2 String deviceName = System.getProperty("deviceName");3 String deviceOS = System.getProperty("deviceOS");4 String deviceOSVersion = System.getProperty("deviceOSVersion");5 String deviceManufacturer = System.getProperty("deviceManufacturer");6 String deviceModel = System.getProperty("deviceModel");7 String deviceScreenSize = System.getProperty("deviceScreenSize");8 String deviceScreenResolution = System.getProperty("deviceScreenResolution");9 String deviceLocation = System.getProperty("deviceLocation");10 String deviceLocationTimeZone = System.getProperty("deviceLocationTimeZone");11 String deviceCarrier = System.getProperty("deviceCarrier");12 String deviceScreenOrientation = System.getProperty("deviceScreenOrientation");13 String deviceScreenDensity = System.getProperty("deviceScreenDensity");14 String deviceScreenDPI = System.getProperty("deviceScreenDPI");15 String deviceScreenDepth = System.getProperty("deviceScreenDepth");16 String deviceScreenPixelRatio = System.getProperty("deviceScreenPixelRatio");17 String deviceScreenTouch = System.getProperty("deviceScreenTouch");18 String deviceScreenMultitouch = System.getProperty("deviceScreenMultitouch");19 String deviceScreenMultitouchMax = System.getProperty("deviceScreenMultitouchMax");20 String deviceScreenMultitouchJazzHand = System.getProperty("deviceScreenMultitouchJazzHand");21 String deviceScreenImageFormat = System.getProperty("deviceScreenImageFormat");22 String deviceScreenVideoFormat = System.getProperty("deviceScreenVideoFormat");23 String deviceScreenVideoCodec = System.getProperty("deviceScreenVideoCodec");24 String deviceScreenVideoQuality = System.getProperty("deviceScreenVideoQuality");25 String deviceScreenVideoSize = System.getProperty("deviceScreenVideoSize");26 String deviceScreenVideoFPS = System.getProperty("deviceScreenVideoFPS");27 String deviceScreenVideoBitRate = System.getProperty("deviceScreenVideoBitRate");28 String deviceScreenVideoRotation = System.getProperty("deviceScreenVideoRotation");29 String deviceScreenVideoLossless = System.getProperty("deviceScreenVideoLossless");30 String deviceScreenVideoPreview = System.getProperty("deviceScreenVideoPreview");31 String deviceScreenVideoPreviewSize = System.getProperty("deviceScreenVideoPreviewSize");32 String deviceScreenVideoPreviewFPS = System.getProperty("deviceScreenVideoPreviewFPS");33 String deviceScreenVideoPreviewBitRate = System.getProperty("deviceScreenVideo

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful