Best Cerberus-source code snippet using org.cerberus.crud.entity.TestCaseExecution.getSeleniumIP
Source:RobotServerService.java
...168 session.setCerberus_selenium_wait_element(cerberus_selenium_wait_element);169 session.setCerberus_appium_wait_element(cerberus_appium_wait_element);170 session.setCerberus_selenium_action_click_timeout(cerberus_selenium_action_click_timeout);171 session.setCerberus_appium_action_longpress_wait(cerberus_appium_action_longpress_wait);172 session.setHost(tCExecution.getSeleniumIP());173 session.setHostUser(tCExecution.getSeleniumIPUser());174 session.setHostPassword(tCExecution.getSeleniumIPPassword());175 session.setPort(tCExecution.getRobotPort());176 session.setCerberus_selenium_autoscroll(cerberus_selenium_autoscroll);177 session.setCerberus_selenium_autoscroll_vertical_offset(cerberus_selenium_autoscroll_vertical_offset);178 session.setCerberus_selenium_autoscroll_horizontal_offset(cerberus_selenium_autoscroll_horizontal_offset);179 tCExecution.setSession(session);180 tCExecution.setRobotProvider(guessRobotProvider(session.getHost()));181 LOG.debug("Session is set.");182 /**183 * Starting Cerberus Executor Proxy if it has been activated at184 * robot level.185 */186 if (tCExecution.getRobotExecutorObj() != null && "Y".equals(tCExecution.getRobotExecutorObj().getExecutorProxyActive())) {187 LOG.debug("Start Remote Proxy");188 this.startRemoteProxy(tCExecution);189 LOG.debug("Started Remote Proxy on port:" + tCExecution.getRemoteProxyPort());190 }191 /**192 * SetUp Capabilities193 */194 LOG.debug("Set Capabilities");195 MutableCapabilities caps = this.setCapabilities(tCExecution);196 session.setDesiredCapabilities(caps);197 LOG.debug("Set Capabilities - retreived");198 /**199 * We record Caps list at the execution level.200 */201 try {202 // Init additionalFinalCapabilities and set it from real caps.203 List<RobotCapability> additionalFinalCapabilities = new ArrayList<>();204 for (Map.Entry cap : caps.asMap().entrySet()) {205 additionalFinalCapabilities.add(factoryRobotCapability.create(0, "", cap.getKey().toString(), cap.getValue().toString()));206 }207 // Init inputCapabilities and set it from Robot values.208 List<RobotCapability> inputCapabilities = new ArrayList<>();209 if (tCExecution.getRobotObj() != null) {210 inputCapabilities = tCExecution.getRobotObj().getCapabilities();211 }212 tCExecution.addFileList(recorderService.recordCapabilities(tCExecution, inputCapabilities, additionalFinalCapabilities));213 } catch (Exception ex) {214 LOG.error("Exception Saving Robot Caps " + tCExecution.getId() + " Exception :" + ex.toString(), ex);215 }216 /**217 * SetUp Proxy218 */219 String hubUrl = StringUtil.cleanHostURL(RobotServerService.getBaseUrl(StringUtil.formatURLCredential(220 tCExecution.getSession().getHostUser(),221 tCExecution.getSession().getHostPassword(), session.getHost()),222 session.getPort())) + "/wd/hub";223 LOG.debug("Hub URL :" + hubUrl);224 URL url = new URL(hubUrl);225 HttpCommandExecutor executor = null;226 boolean isProxy = proxyService.useProxy(hubUrl, system);227// HttpClientBuilder builder = HttpClientBuilder.create();228 Factory factory = new OkHttpClient.Factory();229 // Timeout Management230 int robotTimeout = parameterService.getParameterIntegerByKey("cerberus_robot_timeout", system, 60000);231 Duration rbtTimeOut = Duration.ofMillis(robotTimeout);232 factory.builder().connectionTimeout(rbtTimeOut);233// RequestConfig.Builder requestBuilder = RequestConfig.custom();234// requestBuilder = requestBuilder.setConnectTimeout(robotTimeout);235// requestBuilder = requestBuilder.setConnectionRequestTimeout(robotTimeout);236// requestBuilder = requestBuilder.setSocketTimeout(robotTimeout);237// builder.setDefaultRequestConfig(requestBuilder.build());238 if (isProxy) {239 // Proxy Management240 String proxyHost = parameterService.getParameterStringByKey("cerberus_proxy_host", system, DEFAULT_PROXY_HOST);241 int proxyPort = parameterService.getParameterIntegerByKey("cerberus_proxy_port", system, DEFAULT_PROXY_PORT);242// HttpHost proxy = new HttpHost(proxyHost, proxyPort);243// SocketAddress sa = new SocketAddress() {244// }245 java.net.Proxy myproxy = new java.net.Proxy(java.net.Proxy.Type.HTTP, new InetSocketAddress(proxyHost, proxyPort));246// Proxy proxy = new Proxy(Proxy.Type.SOCKS, proxyAddr);247// builder.setProxy(proxy);248 if (parameterService.getParameterBooleanByKey("cerberus_proxyauthentification_active", system, DEFAULT_PROXYAUTHENT_ACTIVATE)) {249 String proxyUser = parameterService.getParameterStringByKey("cerberus_proxyauthentification_user", system, DEFAULT_PROXYAUTHENT_USER);250 String proxyPassword = parameterService.getParameterStringByKey("cerberus_proxyauthentification_password", system, DEFAULT_PROXYAUTHENT_PASSWORD);251 Authenticator proxyAuthenticator = new Authenticator() {252 public Request authenticate(Route route, Response response) throws IOException {253 String credential = Credentials.basic(proxyUser, proxyPassword);254 return response.request().newBuilder()255 .header("Proxy-Authorization", credential)256 .build();257 }258 };259 factory.builder().proxy(myproxy);260// CredentialsProvider credsProvider = new BasicCredentialsProvider();261//262// credsProvider.setCredentials(new AuthScope(proxyHost, proxyPort), new UsernamePasswordCredentials(proxyUser, proxyPassword));263//264// if (url.getUserInfo() != null && !url.getUserInfo().isEmpty()) {265// credsProvider.setCredentials(266// new AuthScope(url.getHost(), (url.getPort() > 0 ? url.getPort() : url.getDefaultPort())),267// new UsernamePasswordCredentials(tCExecution.getSession().getHostUser(), tCExecution.getSession().getHostPassword())268// );269// }270// builder.setDefaultCredentialsProvider(credsProvider);271 } else {272 factory.builder().proxy(myproxy);273 }274 } else {275 factory.builder().proxy(java.net.Proxy.NO_PROXY);276 }277 executor = new HttpCommandExecutor(new HashMap<>(), url, factory);278// executor = new HttpCommandExecutor(new HashMap<>(), url);279 /**280 * SetUp Driver281 */282 LOG.debug("Set Driver");283 WebDriver driver = null;284 AppiumDriver appiumDriver = null;285 switch (tCExecution.getApplicationObj().getType().toUpperCase()) {286 case Application.TYPE_GUI:287 if (caps.getPlatform() != null && caps.getPlatform().is(Platform.ANDROID)) {288 // Appium does not support connection from HTTPCommandExecutor. When connecting from Executor, it stops to work after a couple of instructions.289 appiumDriver = new AndroidDriver(url, caps);290 driver = (WebDriver) appiumDriver;291 } else if (caps.getPlatform() != null && (caps.getPlatform().is(Platform.IOS) || caps.getPlatform().is(Platform.MAC))) {292 appiumDriver = new IOSDriver(url, caps);293 driver = (WebDriver) appiumDriver;294 } else {295 driver = new RemoteWebDriver(executor, caps);296 }297 tCExecution.setRobotSessionID(getSession(driver, tCExecution.getRobotProvider()));298 break;299 case Application.TYPE_APK:300 // add a lock on app path this part of code, because we can't install 2 apk with the same name simultaneously301 String appUrl = null;302 if (caps.getCapability("app") != null) {303 appUrl = caps.getCapability("app").toString();304 }305 int toto = totocpt++;306 if (appUrl != null) { // FIX : appium can't install 2 apk simultaneously, so implement a litle latency between execution307 synchronized (this) {308 // with appium 1.7.2, we can't install 2 fresh apk simultaneously. Appium have to prepare the apk (transformation) on the first execution before (see this topic https://discuss.appium.io/t/execute-2-android-test-simultaneously-problem-during-install-apk/22030)309 // provoque a latency if first test is already running and apk don't finish to be prepared310 if (apkAlreadyPrepare.containsKey(appUrl) && !apkAlreadyPrepare.get(appUrl)) {311 Thread.sleep(10000);312 } else {313 apkAlreadyPrepare.put(appUrl, false);314 }315 }316 }317 appiumDriver = new AndroidDriver(url, caps);318 if (apkAlreadyPrepare.containsKey(appUrl)) {319 apkAlreadyPrepare.put(appUrl, true);320 }321 driver = (WebDriver) appiumDriver;322 tCExecution.setRobotSessionID(getSession(driver, tCExecution.getRobotProvider()));323 break;324 case Application.TYPE_IPA:325 appiumDriver = new IOSDriver(url, caps);326 driver = (WebDriver) appiumDriver;327 tCExecution.setRobotSessionID(getSession(driver, tCExecution.getRobotProvider()));328 break;329 case Application.TYPE_FAT:330 /**331 * Check sikuli extension is reachable332 */333 if (!sikuliService.isSikuliServerReachable(session)) {334 MessageGeneral mes = new MessageGeneral(MessageGeneralEnum.VALIDATION_FAILED_SIKULI_COULDNOTCONNECT);335 mes.setDescription(mes.getDescription().replace("%SSIP%", tCExecution.getSeleniumIP()));336 mes.setDescription(mes.getDescription().replace("%SSPORT%", tCExecution.getSeleniumPort()));337 throw new CerberusException(mes);338 }339 /**340 * If CountryEnvParameter IP is set, open the App341 */342 if (!tCExecution.getCountryEnvironmentParameters().getIp().isEmpty()) {343 sikuliService.doSikuliActionOpenApp(session, tCExecution.getCountryEnvironmentParameters().getIp());344 }345 break;346 }347 /**348 * We record Server Side Caps.349 */350 if (driver != null) {351 try {352 // Init additionalFinalCapabilities and set it from real caps.353 List<RobotCapability> serverCapabilities = new ArrayList<>();354 for (Map.Entry cap : ((RemoteWebDriver) driver).getCapabilities().asMap().entrySet()) {355 serverCapabilities.add(factoryRobotCapability.create(0, "", cap.getKey().toString(), cap.getValue().toString()));356 }357 tCExecution.addFileList(recorderService.recordServerCapabilities(tCExecution, serverCapabilities));358 } catch (Exception ex) {359 LOG.error("Exception Saving Server Robot Caps " + tCExecution.getId(), ex);360 }361 }362 /**363 * Defining the timeout at the driver level. Only in case of not364 * Appium Driver (see365 * https://github.com/vertigo17/Cerberus/issues/754)366 */367 if (driver != null && appiumDriver == null) {368 driver.manage().timeouts().pageLoadTimeout(cerberus_selenium_pageLoadTimeout, TimeUnit.MILLISECONDS);369 driver.manage().timeouts().implicitlyWait(cerberus_selenium_implicitlyWait, TimeUnit.MILLISECONDS);370 driver.manage().timeouts().setScriptTimeout(cerberus_selenium_setScriptTimeout, TimeUnit.MILLISECONDS);371 }372 tCExecution.getSession().setDriver(driver);373 tCExecution.getSession().setAppiumDriver(appiumDriver);374 /**375 * If Gui application, maximize window Get IP of Node in case of376 * remote Server. Maximize does not work for chrome browser We also377 * get the Real UserAgent from the browser.378 */379 if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_GUI)380 && !caps.getPlatform().equals(Platform.ANDROID) && !caps.getPlatform().equals(Platform.IOS)381 && !caps.getPlatform().equals(Platform.MAC)) {382 if (!caps.getBrowserName().equals(BrowserType.CHROME)) {383 driver.manage().window().maximize();384 }385 getIPOfNode(tCExecution);386 /**387 * If screenSize is defined, set the size of the screen.388 */389 String targetScreensize = getScreenSizeToUse(tCExecution.getTestCaseObj().getScreenSize(), tCExecution.getScreenSize());390 LOG.debug("Selenium resolution : " + targetScreensize);391 if (!tCExecution.getBrowser().equalsIgnoreCase(BrowserType.CHROME)) {392 // For chrome the resolution has already been defined at capabilities level.393 if ((!StringUtil.isNullOrEmpty(targetScreensize)) && targetScreensize.contains("*")) {394 Integer screenWidth = Integer.valueOf(targetScreensize.split("\\*")[0]);395 Integer screenLength = Integer.valueOf(targetScreensize.split("\\*")[1]);396 setScreenSize(driver, screenWidth, screenLength);397 LOG.debug("Selenium resolution Activated : " + screenWidth + "*" + screenLength);398 }399 }400 tCExecution.setScreenSize(getScreenSize(driver));401 tCExecution.setRobotDecli(tCExecution.getRobotDecli().replace("%SCREENSIZE%", tCExecution.getScreenSize()));402 String userAgent = (String) ((JavascriptExecutor) driver).executeScript("return navigator.userAgent;");403 tCExecution.setUserAgent(userAgent);404 }405 // unlock device if deviceLockUnlock is active406 if (tCExecution.getRobotExecutorObj() != null && appiumDriver != null && appiumDriver instanceof LocksDevice407 && "Y".equals(tCExecution.getRobotExecutorObj().getDeviceLockUnlock())) {408 ((LocksDevice) appiumDriver).unlockDevice();409 }410 tCExecution.getSession().setStarted(true);411 } catch (CerberusException exception) {412 LOG.error(exception.toString(), exception);413 throw new CerberusException(exception.getMessageError(), exception);414 } catch (MalformedURLException exception) {415 LOG.error(exception.toString(), exception);416 MessageGeneral mes = new MessageGeneral(MessageGeneralEnum.VALIDATION_FAILED_URL_MALFORMED);417 mes.setDescription(mes.getDescription().replace("%URL%", tCExecution.getSession().getHost() + ":" + tCExecution.getSession().getPort()));418 throw new CerberusException(mes, exception);419 } catch (UnreachableBrowserException exception) {420 LOG.warn("Could not connect to : " + tCExecution.getSeleniumIP() + ":" + tCExecution.getSeleniumPort());421// LOG.error("UnreachableBrowserException catched.", exception);422 MessageGeneral mes = new MessageGeneral(MessageGeneralEnum.VALIDATION_FAILED_SELENIUM_COULDNOTCONNECT);423 mes.setDescription(mes.getDescription().replace("%SSIP%", tCExecution.getSeleniumIP()));424 mes.setDescription(mes.getDescription().replace("%SSPORT%", tCExecution.getSeleniumPort()));425 mes.setDescription(mes.getDescription().replace("%ERROR%", exception.toString()));426 throw new CerberusException(mes, exception);427 } catch (Exception exception) {428 LOG.error(exception.toString(), exception);429 MessageGeneral mes = new MessageGeneral(MessageGeneralEnum.EXECUTION_FA_SELENIUM);430 mes.setDescription(mes.getDescription().replace("%MES%", exception.toString()));431 this.stopRemoteProxy(tCExecution);432 throw new CerberusException(mes, exception);433 } finally {434 executionThreadPoolService.executeNextInQueueAsynchroneously(false);435 }436 }437 private String getSession(WebDriver driver, String robotProvider) {...
Source:SeleniumServerService.java
...138 session.setCerberus_selenium_setScriptTimeout(cerberus_selenium_setScriptTimeout);139 session.setCerberus_selenium_wait_element(cerberus_selenium_wait_element);140 session.setCerberus_appium_wait_element(cerberus_appium_wait_element);141 session.setCerberus_selenium_action_click_timeout(cerberus_selenium_action_click_timeout);142 session.setHost(tCExecution.getSeleniumIP());143 session.setHostUser(tCExecution.getSeleniumIPUser());144 session.setHostPassword(tCExecution.getSeleniumIPPassword());145 session.setPort(tCExecution.getPort());146 tCExecution.setSession(session);147 LOG.debug(logPrefix + "Session is set.");148 /**149 * SetUp Capabilities150 */151 LOG.debug(logPrefix + "Set Capabilities");152 DesiredCapabilities caps = this.setCapabilities(tCExecution);153 session.setDesiredCapabilities(caps);154 LOG.debug(logPrefix + "Set Capabilities - retreived");155 /**156 * SetUp Proxy157 */158 String hubUrl = StringUtil.cleanHostURL(159 SeleniumServerService.getBaseUrl(StringUtil.formatURLCredential(160 tCExecution.getSession().getHostUser(),161 tCExecution.getSession().getHostPassword()) + session.getHost(),162 session.getPort())) + "/wd/hub";163 LOG.debug(logPrefix + "Hub URL :" + hubUrl);164 URL url = new URL(hubUrl);165 HttpCommandExecutor executor = null;166 boolean isProxy = proxyService.useProxy(hubUrl, system);167 if (isProxy) {168 String proxyHost = parameterService.getParameterStringByKey("cerberus_proxy_host", system, DEFAULT_PROXY_HOST);169 int proxyPort = parameterService.getParameterIntegerByKey("cerberus_proxy_port", system, DEFAULT_PROXY_PORT);170 HttpClientBuilder builder = HttpClientBuilder.create();171 HttpHost proxy = new HttpHost(proxyHost, proxyPort);172 builder.setProxy(proxy);173 if (parameterService.getParameterBooleanByKey("cerberus_proxyauthentification_active", system, DEFAULT_PROXYAUTHENT_ACTIVATE)) {174 String proxyUser = parameterService.getParameterStringByKey("cerberus_proxyauthentification_user", system, DEFAULT_PROXYAUTHENT_USER);175 String proxyPassword = parameterService.getParameterStringByKey("cerberus_proxyauthentification_password", system, DEFAULT_PROXYAUTHENT_PASSWORD);176 CredentialsProvider credsProvider = new BasicCredentialsProvider();177 credsProvider.setCredentials(new AuthScope(proxyHost, proxyPort), new UsernamePasswordCredentials(proxyUser, proxyPassword));178 if (url.getUserInfo() != null && !url.getUserInfo().isEmpty()) {179 credsProvider.setCredentials(new AuthScope(url.getHost(), (url.getPort() > 0 ? url.getPort() : url.getDefaultPort())), new UsernamePasswordCredentials(url.getUserInfo()));180 }181 builder.setDefaultCredentialsProvider(credsProvider);182 }183 Factory factory = new MyHttpClientFactory(builder);184 executor = new HttpCommandExecutor(new HashMap<String, CommandInfo>(), url, factory);185 }186 /**187 * SetUp Driver188 */189 LOG.debug(logPrefix + "Set Driver");190 WebDriver driver = null;191 AppiumDriver appiumDriver = null;192 if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_GUI)) {193 if (caps.getPlatform().is(Platform.ANDROID)) {194 if (executor == null) {195 appiumDriver = new AndroidDriver(url, caps);196 } else {197 appiumDriver = new AndroidDriver(executor, caps);198 }199 driver = (WebDriver) appiumDriver;200 } else if (caps.getPlatform().is(Platform.MAC)) {201 if (executor == null) {202 appiumDriver = new IOSDriver(url, caps);203 } else {204 appiumDriver = new IOSDriver(executor, caps);205 }206 driver = (WebDriver) appiumDriver;207 } else // Any Other208 {209 if (executor == null) {210 driver = new RemoteWebDriver(url, caps);211 } else {212 driver = new RemoteWebDriver(executor, caps);213 }214 }215 } else if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_APK)) {216 if (executor == null) {217 appiumDriver = new AndroidDriver(url, caps);218 } else {219 appiumDriver = new AndroidDriver(executor, caps);220 }221 driver = (WebDriver) appiumDriver;222 } else if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_IPA)) {223 if (executor == null) {224 appiumDriver = new IOSDriver(url, caps);225 } else {226 appiumDriver = new IOSDriver(executor, caps);227 }228 driver = (WebDriver) appiumDriver;229 } else if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_FAT)) {230 /**231 * Check sikuli extension is reachable232 */233 if (!sikuliService.isSikuliServerReachable(session)) {234 MessageGeneral mes = new MessageGeneral(MessageGeneralEnum.VALIDATION_FAILED_SIKULI_COULDNOTCONNECT);235 mes.setDescription(mes.getDescription().replace("%SSIP%", tCExecution.getSeleniumIP()));236 mes.setDescription(mes.getDescription().replace("%SSPORT%", tCExecution.getSeleniumPort()));237 throw new CerberusException(mes);238 }239 /**240 * If CountryEnvParameter IP is set, open the App241 */242 if (!tCExecution.getCountryEnvironmentParameters().getIp().isEmpty()) {243 sikuliService.doSikuliActionOpenApp(session, tCExecution.getCountryEnvironmentParameters().getIp());244 }245 }246 /**247 * Defining the timeout at the driver level. Only in case of not248 * Appium Driver (see249 * https://github.com/vertigo17/Cerberus/issues/754)250 */251 if (driver != null && appiumDriver == null) {252 driver.manage().timeouts().pageLoadTimeout(cerberus_selenium_pageLoadTimeout, TimeUnit.MILLISECONDS);253 driver.manage().timeouts().implicitlyWait(cerberus_selenium_implicitlyWait, TimeUnit.MILLISECONDS);254 driver.manage().timeouts().setScriptTimeout(cerberus_selenium_setScriptTimeout, TimeUnit.MILLISECONDS);255 }256 tCExecution.getSession().setDriver(driver);257 tCExecution.getSession().setAppiumDriver(appiumDriver);258 /**259 * If Gui application, maximize window Get IP of Node in case of260 * remote Server. Maximize does not work for chrome browser We also261 * get the Real UserAgent from the browser.262 */263 if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_GUI)264 && !caps.getPlatform().equals(Platform.ANDROID)) {265 if (!caps.getBrowserName().equals(BrowserType.CHROME)) {266 driver.manage().window().maximize();267 }268 getIPOfNode(tCExecution);269 /**270 * If screenSize is defined, set the size of the screen.271 */272 String targetScreensize = getScreenSizeToUse(tCExecution.getTestCaseObj().getScreenSize(), tCExecution.getScreenSize());273 LOG.debug("Selenium resolution : " + targetScreensize);274 if ((!StringUtil.isNullOrEmpty(targetScreensize)) && targetScreensize.contains("*")) {275 Integer screenWidth = Integer.valueOf(targetScreensize.split("\\*")[0]);276 Integer screenLength = Integer.valueOf(targetScreensize.split("\\*")[1]);277 setScreenSize(driver, screenWidth, screenLength);278 LOG.debug("Selenium resolution Activated : " + screenWidth + "*" + screenLength);279 }280 tCExecution.setScreenSize(getScreenSize(driver));281 tCExecution.setRobotDecli(tCExecution.getRobotDecli().replace("%SCREENSIZE%", tCExecution.getScreenSize()));282 String userAgent = (String) ((JavascriptExecutor) driver).executeScript("return navigator.userAgent;");283 tCExecution.setUserAgent(userAgent);284 }285 tCExecution.getSession().setStarted(true);286 } catch (CerberusException exception) {287 LOG.error(logPrefix + exception.toString(), exception);288 throw new CerberusException(exception.getMessageError());289 } catch (MalformedURLException exception) {290 LOG.error(logPrefix + exception.toString(), exception);291 MessageGeneral mes = new MessageGeneral(MessageGeneralEnum.VALIDATION_FAILED_URL_MALFORMED);292 mes.setDescription(mes.getDescription().replace("%URL%", tCExecution.getSession().getHost() + ":" + tCExecution.getSession().getPort()));293 throw new CerberusException(mes);294 } catch (UnreachableBrowserException exception) {295 LOG.error(logPrefix + exception.toString(), exception);296 MessageGeneral mes = new MessageGeneral(MessageGeneralEnum.VALIDATION_FAILED_SELENIUM_COULDNOTCONNECT);297 mes.setDescription(mes.getDescription().replace("%SSIP%", tCExecution.getSeleniumIP()));298 mes.setDescription(mes.getDescription().replace("%SSPORT%", tCExecution.getSeleniumPort()));299 mes.setDescription(mes.getDescription().replace("%ERROR%", exception.toString()));300 throw new CerberusException(mes);301 } catch (Exception exception) {302 LOG.error(logPrefix + exception.toString(), exception);303 MessageGeneral mes = new MessageGeneral(MessageGeneralEnum.EXECUTION_FA_SELENIUM);304 mes.setDescription(mes.getDescription().replace("%MES%", exception.toString()));305 throw new CerberusException(mes);306 }307 }308 /**309 * Set DesiredCapabilities310 *311 * @param tCExecution...
Source:ReadCerberusDetailInformation.java
...80 object.put("system", execution.getApplicationObj().getSystem());81 object.put("application", execution.getApplication());82 object.put("environment", execution.getEnvironmentData());83 object.put("country", execution.getCountry());84 object.put("robotIP", execution.getSeleniumIP());85 object.put("tag", execution.getTag());86 object.put("start", new Timestamp(execution.getStart()));87 executionArray.put(object);88 }89 jsonResponse.put("simultaneous_execution_list", executionArray);90 jsonResponse.put("simultaneous_session", sc.getTotalActiveSession());91 jsonResponse.put("active_users", sc.getActiveUsers());92 cerberusDatabaseInformation = appContext.getBean(ICerberusInformationDAO.class);93 AnswerItem ans = cerberusDatabaseInformation.getDatabaseInformation();94 HashMap<String, String> cerberusInformation = (HashMap<String, String>) ans.getItem();95 // Database Informations.96 jsonResponse.put("DatabaseProductName", cerberusInformation.get("DatabaseProductName"));97 jsonResponse.put("DatabaseProductVersion", cerberusInformation.get("DatabaseProductVersion"));98 jsonResponse.put("DatabaseMajorVersion", cerberusInformation.get("DatabaseMajorVersion"));...
getSeleniumIP
Using AI Code Generation
1TestCaseExecution tce = new TestCaseExecution();2String seleniumIP = tce.getSeleniumIP();3TestCaseExecution tce = new TestCaseExecution();4String seleniumIP = tce.getSeleniumIP();5TestCaseExecution tce = new TestCaseExecution();6String seleniumIP = tce.getSeleniumIP();7TestCaseExecution tce = new TestCaseExecution();8String seleniumIP = tce.getSeleniumIP();9TestCaseExecution tce = new TestCaseExecution();10String seleniumIP = tce.getSeleniumIP();11TestCaseExecution tce = new TestCaseExecution();12String seleniumIP = tce.getSeleniumIP();13TestCaseExecution tce = new TestCaseExecution();14String seleniumIP = tce.getSeleniumIP();15TestCaseExecution tce = new TestCaseExecution();16String seleniumIP = tce.getSeleniumIP();17TestCaseExecution tce = new TestCaseExecution();18String seleniumIP = tce.getSeleniumIP();19TestCaseExecution tce = new TestCaseExecution();20String seleniumIP = tce.getSeleniumIP();21TestCaseExecution tce = new TestCaseExecution();22String seleniumIP = tce.getSeleniumIP();
getSeleniumIP
Using AI Code Generation
1package org.cerberus.test;2import org.cerberus.crud.entity.TestCaseExecution;3import org.cerberus.engine.entity.MessageEvent;4import org.cerberus.engine.execution.impl.ManualExecution;5import org.cerberus.engine.queuemanagement.impl.ExecutorServiceTask;6import org.cerberus.engine.queuemanagement.impl.ManualTask;7import org.cerberus.exception.CerberusException;8import org.cerberus.util.answer.AnswerItem;9public class SeleniumIPTest {10 public static void main(String[] args) {11 TestCaseExecution tce = new TestCaseExecution("SeleniumIPTest", "SeleniumIPTest", "QA");12 tce.setSeleniumIP("
getSeleniumIP
Using AI Code Generation
1String seleniumIP = getSeleniumIP();2selenium.start();3String seleniumIP = getSeleniumIP();4selenium.start();5String seleniumIP = getSeleniumIP();6selenium.start();7String seleniumIP = getSeleniumIP();8selenium.start();
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!