How to use appendSeleniumVersion method of com.paypal.selion.internal.platform.grid.browsercapabilities.AdditionalSauceCapabilitiesBuilder class

Best SeLion code snippet using com.paypal.selion.internal.platform.grid.browsercapabilities.AdditionalSauceCapabilitiesBuilder.appendSeleniumVersion

Source:AdditionalSauceCapabilitiesBuilder.java Github

copy

Full Screen

...43 return capabilities;44 }45 capabilities = appendSauceLabsCredentials(capabilities);46 capabilities = appendSauceLabsTunnel(capabilities);47 capabilities = appendSeleniumVersion(capabilities);48 capabilities = appendSauceLabsCapabilities(capabilities);49 logger.exiting(capabilities);50 return capabilities;51 }52 private DesiredCapabilities appendSauceLabsCapabilities(DesiredCapabilities capabilities) {53 logger.entering(capabilities);54 String sauceJSONFileName = Config.getConfigProperty(ConfigProperty.SELENIUM_SAUCELAB_GRID_CONFIG_FILE);55 if (StringUtils.isBlank(sauceJSONFileName)) {56 logger.exiting(capabilities);57 return capabilities;58 }59 try {60 JsonObject jsonObject = new JsonParser().parse(FileAssistant.readFile(sauceJSONFileName)).getAsJsonObject();61 Iterator<Entry<String, JsonElement>> iterator = jsonObject.entrySet().iterator();62 while (iterator.hasNext()) {63 Entry<String, JsonElement> entry = iterator.next();64 String capabilityName = entry.getKey();65 Object capabilityValue = new JsonToBeanConverter().convert(Object.class, entry.getValue());66 if ((capabilityValue instanceof String) && (capabilityValue.toString().startsWith("__string__"))) {67 capabilityValue = capabilityValue.toString().replace("__string__", "");68 }69 capabilities.setCapability(capabilityName, capabilityValue);70 }71 logger.exiting(capabilities);72 return capabilities;73 } catch (Exception e) { // NOSONAR74 String errorMsg = "An error occured while working with the JSON file : " + sauceJSONFileName75 + ". Root cause: ";76 throw new WebDriverException(errorMsg, e);77 }78 }79 private DesiredCapabilities appendSeleniumVersion(DesiredCapabilities caps) {80 logger.entering(caps);81 String seleniumVersion = new BuildInfo().getReleaseLabel();82 // allows the user to override this capability with their own version83 if (caps.getCapability(SELENIUM_VERSION) == null) {84 caps.setCapability(SELENIUM_VERSION, seleniumVersion);85 }86 logger.exiting(caps);87 return caps;88 }89 private DesiredCapabilities appendSauceLabsCredentials(DesiredCapabilities caps) {90 logger.entering(caps);91 String sauceUserName = Config.getConfigProperty(ConfigProperty.SAUCELAB_USER_NAME);92 String sauceApiKey = Config.getConfigProperty(ConfigProperty.SAUCELAB_API_KEY);93 if (StringUtils.isNotBlank(sauceUserName) && StringUtils.isNotBlank(sauceApiKey)) {...

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.

Run SeLion automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful