How to use doSeleniumActionWait method of org.cerberus.service.webdriver.impl.WebDriverService class

Best Cerberus-source code snippet using org.cerberus.service.webdriver.impl.WebDriverService.doSeleniumActionWait

Source:ActionService.java Github

copy

Full Screen

...913 } else if (identifier != null && identifier.getIdentifier().equals(SikuliService.SIKULI_IDENTIFIER_TEXT)) {914 return sikuliService.doSikuliActionWait(tCExecution.getSession(), "", identifier.getLocator());915 } else if (identifier != null) {916 identifierService.checkWebElementIdentifier(identifier.getIdentifier());917 return webdriverService.doSeleniumActionWait(tCExecution.getSession(), identifier);918 } else {919 return this.waitTime(timeToWaitInMs);920 }921 } else { // For any other application we wait for the integer value.922 if (StringUtil.isNullOrEmpty(element)) {923 // Get default wait from parameter924 timeToWaitInMs = tCExecution.getCerberus_action_wait_default();925 } else if (StringUtil.isInteger(element)) {926 timeToWaitInMs = Long.valueOf(element);927 }928 return this.waitTime(timeToWaitInMs);929 }930 } catch (CerberusEventException ex) {931 LOG.fatal("Error doing Action Wait :" + ex);932 return ex.getMessageError();933 }934 }935 private MessageEvent doActionKeyPress(TestCaseExecution tCExecution, String value1, String value2) {936 try {937 String appType = tCExecution.getApplicationObj().getType();938 /**939 * Check value1 and value2 are not null For IPA and APK, only value2940 * (key to press) is mandatory For GUI and FAT, both parameters are941 * mandatory942 */943 if (StringUtil.isNullOrEmpty(value2)) {944 return new MessageEvent(MessageEventEnum.ACTION_FAILED_KEYPRESS_MISSINGKEY).resolveDescription("APPLICATIONTYPE", appType);945 }946 /**947 * Get Identifier (identifier, locator)948 */949 if (StringUtil.isNullOrEmpty(value1) && appType.equalsIgnoreCase(Application.TYPE_GUI)) {950 value1 = "xpath=//body";951 }952 Identifier objectIdentifier = identifierService.convertStringToIdentifier(value1);953 if (appType.equalsIgnoreCase(Application.TYPE_GUI)) {954 if (tCExecution.getRobotObj().getPlatform().equalsIgnoreCase(Platform.MAC.toString())955 || tCExecution.getRobotObj().getPlatform().equalsIgnoreCase(Platform.IOS.toString())) {956 return iosAppiumService.keyPress(tCExecution.getSession(), value2);957 } else if (tCExecution.getRobotObj().getPlatform().equalsIgnoreCase(Platform.ANDROID.toString())) {958 return webdriverService.doSeleniumActionKeyPress(tCExecution.getSession(), objectIdentifier, value2, false, false);959 }960 if (objectIdentifier.getIdentifier().equals(SikuliService.SIKULI_IDENTIFIER_PICTURE)) {961 return sikuliService.doSikuliActionKeyPress(tCExecution.getSession(), objectIdentifier.getLocator(), value2);962 } else {963 identifierService.checkWebElementIdentifier(objectIdentifier.getIdentifier());964 return webdriverService.doSeleniumActionKeyPress(tCExecution.getSession(), objectIdentifier, value2, true, true);965 }966 } else if (appType.equalsIgnoreCase(Application.TYPE_APK)) {967 return androidAppiumService.keyPress(tCExecution.getSession(), value2);968 } else if (appType.equalsIgnoreCase(Application.TYPE_IPA)) {969 return iosAppiumService.keyPress(tCExecution.getSession(), value2);970 } else if (appType.equalsIgnoreCase(Application.TYPE_FAT)) {971 return sikuliService.doSikuliActionKeyPress(tCExecution.getSession(), objectIdentifier.getLocator(), value2);972 } else {973 return new MessageEvent(MessageEventEnum.ACTION_NOTEXECUTED_NOTSUPPORTED_FOR_APPLICATION)974 .resolveDescription("ACTION", "KeyPress")975 .resolveDescription("APPLICATIONTYPE", appType);976 }977 } catch (CerberusEventException ex) {978 LOG.debug("Error doing Action KeyPress :" + ex);979 return ex.getMessageError();980 } catch (Exception ex) {981 LOG.debug("Error doing Action KeyPress :" + ex);982 return new MessageEvent(MessageEventEnum.ACTION_FAILED_GENERIC)983 .resolveDescription("DETAIL", ex.toString());984 }985 }986 private MessageEvent doActionOpenURL(TestCaseExecution tCExecution, String object, String property, boolean withBase) {987 MessageEvent message;988 String element;989 try {990 /**991 * Get element to use String object if not empty, String property if992 * object empty, throws Exception if both empty)993 */994 element = getElementToUse(object, property, "openUrl[WithBase]", tCExecution);995 /**996 * Get Identifier (identifier, locator)997 */998 Identifier identifier = new Identifier();999 identifier.setIdentifier("url");1000 identifier.setLocator(element);1001 if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_GUI)) {1002 return webdriverService.doSeleniumActionOpenURL(tCExecution.getSession(), tCExecution.getUrl(), identifier, withBase);1003 }1004 message = new MessageEvent(MessageEventEnum.ACTION_NOTEXECUTED_NOTSUPPORTED_FOR_APPLICATION);1005 message.setDescription(message.getDescription().replace("%ACTION%", "OpenURL[WithBase]"));1006 message.setDescription(message.getDescription().replace("%APPLICATIONTYPE%", tCExecution.getApplicationObj().getType()));1007 return message;1008 } catch (CerberusEventException ex) {1009 LOG.fatal("Error doing Action OpenUrl :" + ex);1010 return ex.getMessageError();1011 }1012 }1013 private MessageEvent doActionOpenApp(TestCaseExecution tCExecution, String value1, String value2) {1014 MessageEvent message;1015 /**1016 * Check value1 is not null or empty1017 */1018 if (value1 == null || "".equals(value1)) {1019 return new MessageEvent(MessageEventEnum.ACTION_FAILED_OPENAPP);1020 }1021 if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_FAT)1022 || tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_GUI)) {1023 return sikuliService.doSikuliActionOpenApp(tCExecution.getSession(), value1);1024 } else if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_APK)) {1025 return androidAppiumService.openApp(tCExecution.getSession(), value1, value2);1026 }1027 message = new MessageEvent(MessageEventEnum.ACTION_NOTEXECUTED_NOTSUPPORTED_FOR_APPLICATION);1028 message.setDescription(message.getDescription().replace("%ACTION%", "OpenApp"));1029 message.setDescription(message.getDescription().replace("%APPLICATIONTYPE%", tCExecution.getApplicationObj().getType()));1030 return message;1031 }1032 private MessageEvent doActionCloseApp(TestCaseExecution tCExecution, String value1) {1033 MessageEvent message;1034 /**1035 * Check value1 is not null or empty1036 */1037 if (value1 == null || "".equals(value1)) {1038 return new MessageEvent(MessageEventEnum.ACTION_FAILED_CLOSEAPP);1039 }1040 if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_FAT)1041 || tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_GUI)) {1042 return sikuliService.doSikuliActionCloseApp(tCExecution.getSession(), value1);1043 }1044 message = new MessageEvent(MessageEventEnum.ACTION_NOTEXECUTED_NOTSUPPORTED_FOR_APPLICATION);1045 message.setDescription(message.getDescription().replace("%ACTION%", "CloseApp"));1046 message.setDescription(message.getDescription().replace("%APPLICATIONTYPE%", tCExecution.getApplicationObj().getType()));1047 return message;1048 }1049 private MessageEvent doActionWaitVanish(TestCaseExecution tCExecution, String value1) {1050 try {1051 /**1052 * Check value1 is not null or empty1053 */1054 if (value1 == null || "".equals(value1)) {1055 return new MessageEvent(MessageEventEnum.ACTION_FAILED_CLOSEAPP);1056 }1057 /**1058 * Get Identifier (identifier, locator)1059 */1060 Identifier identifier = identifierService.convertStringToIdentifier(value1);1061 if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_GUI)) {1062 if (identifier.getIdentifier().equals(SikuliService.SIKULI_IDENTIFIER_PICTURE)) {1063 return sikuliService.doSikuliActionWaitVanish(tCExecution.getSession(), identifier.getLocator(), "");1064 } else if (identifier.getIdentifier().equals(SikuliService.SIKULI_IDENTIFIER_TEXT)) {1065 return sikuliService.doSikuliActionWaitVanish(tCExecution.getSession(), "", identifier.getLocator());1066 } else {1067 identifierService.checkWebElementIdentifier(identifier.getIdentifier());1068 return webdriverService.doSeleniumActionWaitVanish(tCExecution.getSession(), identifier);1069 }1070 } else if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_APK)1071 || tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_IPA)) {1072 identifierService.checkWebElementIdentifier(identifier.getIdentifier());1073 return webdriverService.doSeleniumActionWaitVanish(tCExecution.getSession(), identifier);1074 } else if (tCExecution.getApplicationObj().getType().equalsIgnoreCase(Application.TYPE_FAT)) {1075 identifierService.checkSikuliIdentifier(identifier.getIdentifier());1076 if (identifier.getIdentifier().equals(SikuliService.SIKULI_IDENTIFIER_PICTURE)) {1077 return sikuliService.doSikuliActionWaitVanish(tCExecution.getSession(), identifier.getLocator(), "");1078 } else {1079 return sikuliService.doSikuliActionWaitVanish(tCExecution.getSession(), "", identifier.getLocator());1080 }1081 } else {1082 return new MessageEvent(MessageEventEnum.ACTION_NOTEXECUTED_NOTSUPPORTED_FOR_APPLICATION)1083 .resolveDescription("ACTION", "WaitVanish")1084 .resolveDescription("APPLICATIONTYPE", tCExecution.getApplicationObj().getType());1085 }1086 } catch (CerberusEventException ex) {1087 LOG.fatal("Error doing Action KeyPress :" + ex);...

Full Screen

Full Screen

doSeleniumActionWait

Using AI Code Generation

copy

Full Screen

1doSeleniumActionWait("waitElementPresent", "elementId", "id", "10");2doSeleniumActionWait("waitElementPresent", ".elementClass", "cssSelector", "30");3doSeleniumActionWait("waitElementPresent", "elementName", "name", "90");4doSeleniumActionWait("waitElementPresent", "elementLink", "link", "120");5doSeleniumActionWait("waitElementPresent", "elementPartialLink", "partialLink", "180");6doSeleniumActionWait("waitElementPresent", "elementTagName", "tagName", "240");7doSeleniumActionWait("waitElementPresent", "elementClassName", "className", "300");8doSeleniumActionWait("waitElementPresent", "elementJs", "js", "360");

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