How to use processDeprecatedCapabilities method of com.paypal.selion.proxy.SeLionSauceProxy class

Best SeLion code snippet using com.paypal.selion.proxy.SeLionSauceProxy.processDeprecatedCapabilities

Source:SeLionSauceProxy.java Github

copy

Full Screen

...128 try {129 accessLock.lock();130 // check for backwards compatible capability names that might come across the wire131 // TODO remove backwards compatible support in a future version.132 processDeprecatedCapabilities(requestedCapabilities);133 // default the credentials, if required134 processCredentials(requestedCapabilities);135 // setup the tunnelIdentifier, if required136 processTunnelIdentifierCapability(requestedCapabilities);137 // setup the parent-tunnel, if required138 processParentTunnelCapability(requestedCapabilities);139 // override any idleTimeout capability that may have been specified. Sauce and this proxy need to have140 // a similar idle timeout value.141 requestedCapabilities.put(SauceLabsCapability.IDLE_TIMEOUT_CAPABILITY, getTimeOut() / 1000);142 final int numberOfTCRunning = sauceApi.getNumberOfTCRunning();143 // if call to geNumberOfTCRunning returns -1, sauce REST API calls are failing.144 if (numberOfTCRunning == -1) {145 // mark the proxy as down and let the polling thread determine when it is back up.146 down = true;147 // if we aren't polling sauce labs, kick the session back to the hub.148 if (poll == false) {149 LOGGER.exiting(null);150 return null;151 }152 }153 if (numberOfTCRunning <= getMaxNumberOfConcurrentTestSessions()) {154 session = super.getNewSession(requestedCapabilities);155 }156 LOGGER.exiting((session != null) ? session.toString() : null);157 return session;158 } finally {159 accessLock.unlock();160 }161 }162 private void processDeprecatedCapabilities(Map<String, Object> requestedCapabilities) {163 final String username = (String) requestedCapabilities.get(SauceLabsCapability.SAUCE_USER_NAME_CAPABILITY);164 if (StringUtils.isNotBlank(username)) {165 requestedCapabilities.remove(SauceLabsCapability.SAUCE_USER_NAME_CAPABILITY);166 requestedCapabilities.put(SauceLabsCapability.USERNAME_CAPABILITY, username);167 }168 final String accessKey = (String) requestedCapabilities.get(SauceLabsCapability.SAUCE_API_KEY_CAPABILITY);169 if (StringUtils.isNotBlank(accessKey)) {170 requestedCapabilities.remove(SauceLabsCapability.SAUCE_API_KEY_CAPABILITY);171 requestedCapabilities.put(SauceLabsCapability.ACCESS_KEY_CAPABILITY, accessKey);172 }173 }174 private void processParentTunnelCapability(Map<String, Object> requestedCapabilities) {175 final String tunnelId = (String) requestedCapabilities.get(SauceLabsCapability.PARENT_TUNNEL_CAPABILITY);176 if (StringUtils.isBlank(tunnelId) && StringUtils.isNotBlank(defaultParentTunnel)) {...

Full Screen

Full Screen

processDeprecatedCapabilities

Using AI Code Generation

copy

Full Screen

1package com.paypal.selion.proxy;2import java.util.Map;3import java.util.logging.Level;4import java.util.logging.Logger;5import org.openqa.grid.common.RegistrationRequest;6import org.openqa.grid.internal.utils.configuration.GridHubConfiguration;7import org.openqa.grid.selenium.proxy.DefaultRemoteProxy;8public class SeLionSauceProxy extends DefaultRemoteProxy {9 private static final Logger LOGGER = Logger.getLogger(SeLionSauceProxy.class.getName());10 public SeLionSauceProxy(RegistrationRequest request, GridHubConfiguration configuration) {11 super(request, configuration);12 }13 public void beforeCommand(TestSession session, HttpServletRequest request, HttpServletResponse response) {14 Map<String, Object> desiredCapabilities = session.getRequestedCapabilities();15 processDeprecatedCapabilities(desiredCapabilities);16 super.beforeCommand(session, request, response);17 }18 private void processDeprecatedCapabilities(Map<String, Object> desiredCapabilities) {19 if (desiredCapabilities.containsKey("seleniumVersion")) {20 desiredCapabilities.put("seleniumVersion", desiredCapabilities.get("seleniumVersion"));21 LOGGER.log(Level.WARNING, "The capability seleniumVersion is deprecated. Please use browserVersion instead.");22 }23 if (desiredCapabilities.containsKey("max-duration")) {24 desiredCapabilities.put("max-duration", desiredCapabilities.get("max-duration"));25 LOGGER.log(Level.WARNING, "The capability max-duration is deprecated. Please use maxDuration instead.");26 }27 if (desiredCapabilities.containsKey("command-timeout")) {28 desiredCapabilities.put("command-timeout", desiredCapabilities.get("command-timeout"));29 LOGGER.log(Level.WARNING, "The capability command-timeout is deprecated. Please use commandTimeout instead.");30 }31 if (desiredCapabilities.containsKey("idle-timeout")) {32 desiredCapabilities.put("idle-timeout", desiredCapabilities.get("idle-timeout"));33 LOGGER.log(Level.WARNING, "The capability idle-timeout is deprecated. Please use idleTimeout instead.");34 }35 if (desiredCapabilities.containsKey("record-video")) {36 desiredCapabilities.put("record-video", desiredCapabilities.get("record-video"));37 LOGGER.log(Level.WARNING, "The capability record-video is deprecated. Please use recordVideo instead.");38 }39 if (desiredCapabilities.containsKey("record-screenshots")) {40 desiredCapabilities.put("record-screenshots", desiredCapabilities.get("record-screenshots"));41 LOGGER.log(Level.WARNING, "The capability record-screenshots is deprecated. Please use recordScreenshots instead.");42 }43 if (desiredCapabilities.containsKey("

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