use of com.testsigma.automator.exceptions.AutomatorException in project testsigma by testsigmahq.
the class ElementAction method setElementSearchCriteria.
protected void setElementSearchCriteria(String elementActionVariableName) throws AutomatorException {
log.debug("Setting element search criteria");
ElementPropertiesEntity elementPropertiesEntity = getElementPropertiesEntity(elementActionVariableName);
if (StringUtils.isBlank(elementPropertiesEntity.getLocatorValue())) {
throw new AutomatorException(String.format(LOCATOR_VALUE_MISSING_ERROR_MSG, elementPropertiesEntity.getFindByType()));
}
elementSearchCriteria = new ElementSearchCriteria(elementPropertiesEntity.getFindByType(), elementPropertiesEntity.getLocatorValue());
}
use of com.testsigma.automator.exceptions.AutomatorException in project testsigma by testsigmahq.
the class MobileDriver method createDriver.
@Override
protected RemoteWebDriver createDriver(DesiredCapabilities desiredCapabilities) throws AutomatorException {
try {
Calendar startTime = Calendar.getInstance();
createDriverInstance(desiredCapabilities);
log.info("Stating with post mobile driver creation actions");
Calendar endTime = Calendar.getInstance();
log.info("Web Driver Session Created in - " + (endTime.getTimeInMillis() - startTime.getTimeInMillis()));
setTimeouts();
return remoteWebDriver;
} catch (Exception e) {
if (e.getCause() instanceof SSLException || e.getCause() instanceof ConnectException) {
throw new AutomatorException(e.getCause() + String.format(APPIUM_INVALID_URL));
} else {
throw new AutomatorException(e.getMessage(), e);
}
}
}
use of com.testsigma.automator.exceptions.AutomatorException in project testsigma by testsigmahq.
the class SafariDriver method setTimeouts.
@Override
public void setTimeouts() throws AutomatorException {
String osVersion = getPlatform();
int browserVersionValue = Integer.parseInt(getSafariVersion().split("\\.")[0]);
if (((osVersion.equals("macOS 10.13") || osVersion.equals("macOS 10.14") || osVersion.equals("High Sierra")) || (osVersion.equals("macOS 10.15") || osVersion.equals("Catalina"))) && (browserVersionValue >= 12) && (executionLabType != ExecutionLabType.Hybrid)) {
SessionId session = remoteWebDriver.getSessionId();
Map<String, Object> timeouts = new HashMap<>();
timeouts.put("implicit", settings.getElementTimeout() * 1000);
timeouts.put("pageLoad", settings.getPageLoadTimeout() * 1000);
try {
UriComponents uriComponents = UriComponentsBuilder.fromUriString("/session/{sessionId}/timeouts").build().expand(session.toString()).encode();
String url = webDriverSettings.getWebDriverServerUrl() + uriComponents.toUriString();
HttpClient httpClient = EnvironmentRunner.getWebAppHttpClient();
String authHeader = HttpClient.BEARER + " " + getSettings().getJwtApiKey();
HttpResponse<String> response = null;
for (int i = 0; i < 3; i++) {
try {
response = httpClient.post(url, timeouts, new TypeReference<>() {
}, authHeader);
break;
} catch (Exception ex) {
log.error(ex.getMessage(), ex);
}
}
log.error(response.getStatusCode() + " - " + response.getResponseText());
} catch (Exception e) {
log.error(e.getMessage(), e);
throw new AutomatorException(e.getMessage(), e);
}
} else {
super.setTimeouts();
}
}
use of com.testsigma.automator.exceptions.AutomatorException in project testsigma by testsigmahq.
the class WebDriver method setLocation.
protected void setLocation() throws AutomatorException {
if (locationCapability != null) {
try {
String[] coordinates = locationCapability.getCapabilityValue().toString().split(",");
((LocationContext) new Augmenter().augment(getRemoteWebDriver())).setLocation(new Location(Double.parseDouble(coordinates[0]), Double.parseDouble(coordinates[1]), Double.parseDouble(coordinates[2])));
} catch (NumberFormatException e) {
throw new AutomatorException(INVALID_GEO_LOCATION_ERROR);
}
}
}
use of com.testsigma.automator.exceptions.AutomatorException in project testsigma by testsigmahq.
the class DriverManager method storeTestSuiteSessionId.
private void storeTestSuiteSessionId(Long entityId) throws AutomatorException {
try {
TestSuiteResultRequest testSuiteResultRequest = new TestSuiteResultRequest();
testSuiteResultRequest.setId(entityId);
testSuiteResultRequest.setSessionId(getSessionId());
AutomatorConfig.getInstance().getAppBridge().updateTestSuiteResultData(testSuiteResultRequest);
} catch (Exception e) {
log.error(e.getMessage(), e);
throw new AutomatorException(e.getMessage(), e);
}
}
Aggregations