Search in sources :

Example 36 with AutomatorException

use of com.testsigma.automator.exceptions.AutomatorException in project testsigma by testsigmahq.

the class DeviceContainer method syncBrowserDrivers.

public void syncBrowserDrivers(MobileDevice mobileDevice) {
    log.info("Syncing Browser Drivers For Mobile Devices - " + mobileDevice);
    List<AgentBrowser> browserList = mobileDevice.getBrowserList();
    if (browserList == null) {
        return;
    }
    for (AgentBrowser browserObj : browserList) {
        try {
            log.info("Trying to sync driver for mobile browser - " + browserObj);
            OsBrowserType browserType = browserObj.getName();
            String browserVersion = browserObj.getMajorVersion() + "";
            Browsers browser = OsBrowserType.getBrowserType(browserType);
            String driverPath = AutomatorConfig.getInstance().getAppBridge().getDriverExecutablePath(browser.getKey(), browserVersion);
            new DriversUpdateService().syncBrowserDriver(browserType, browserVersion, driverPath);
        } catch (AutomatorException e) {
            log.error(e.getMessage(), e);
        }
    }
}
Also used : AutomatorException(com.testsigma.automator.exceptions.AutomatorException) AgentBrowser(com.testsigma.agent.browsers.AgentBrowser) Browsers(com.testsigma.automator.entity.Browsers) DriversUpdateService(com.testsigma.automator.drivers.DriversUpdateService) OsBrowserType(com.testsigma.automator.entity.OsBrowserType)

Example 37 with AutomatorException

use of com.testsigma.automator.exceptions.AutomatorException in project testsigma by testsigmahq.

the class DriverSessionsController method createSession.

/**
 * Create a remote web driver session using selenium/appium
 *
 * @param driverSessionRequest
 * @return created remote web driver sessionId
 * @throws Exception
 */
@PostMapping
@ResponseBody
public DriverSessionDTO createSession(@RequestBody DriverSessionRequest driverSessionRequest) throws Exception {
    log.debug("Creating a remote web driver session for - " + driverSessionRequest.getUniqueId() + " ( " + driverSessionRequest + ") ");
    if (driverSessionRequest.getMobileSessionId() != null) {
        try {
            String sessionId = driverSessionsService.createSession(driverSessionRequest);
            DriverSessionDTO driverSessionDTO = new DriverSessionDTO();
            driverSessionDTO.setSessionId(sessionId);
            driverSessionDTO.setHostname(AgentService.getComputerName());
            return driverSessionDTO;
        } catch (IOException e) {
            log.error(e.getMessage(), e);
            throw new AutomatorException(e.getMessage(), e);
        }
    } else {
        throw new TestsigmaException("Failed creating driver session: mobileSessionId is NULL");
    }
}
Also used : AutomatorException(com.testsigma.automator.exceptions.AutomatorException) TestsigmaException(com.testsigma.agent.exception.TestsigmaException) IOException(java.io.IOException) DriverSessionDTO(com.testsigma.agent.dto.DriverSessionDTO)

Example 38 with AutomatorException

use of com.testsigma.automator.exceptions.AutomatorException in project testsigma by testsigmahq.

the class RestAPIRunTimeDataProcessor method updateRequestAuthorizationRuntimeValues.

private void updateRequestAuthorizationRuntimeValues() throws AutomatorException {
    log.debug("Updating Run time Data in Authorization data, RestStep ID:" + restfulStepEntity.getId());
    try {
        String updatedAuthData = replaceRuntimeVariables(restfulStepEntity.getAuthorizationValue());
        restfulStepEntity.setAuthorizationValue(updatedAuthData);
    } catch (AutomatorException e) {
        throw new AutomatorException("Error while replacing runtime variables in Request's Authorization field." + e.getMessage());
    }
}
Also used : AutomatorException(com.testsigma.automator.exceptions.AutomatorException)

Example 39 with AutomatorException

use of com.testsigma.automator.exceptions.AutomatorException in project testsigma by testsigmahq.

the class RestAPIRunTimeDataProcessor method updateRequestBodyRuntimeValues.

private void updateRequestBodyRuntimeValues() throws AutomatorException {
    log.debug("Updating Body runtime data for rest step:" + restfulStepEntity.getId());
    try {
        String updatedPayload = replaceRuntimeVariables(restfulStepEntity.getPayload());
        restfulStepEntity.setPayload(updatedPayload);
    } catch (AutomatorException e) {
        throw new AutomatorException("Error while replacing runtime variables in request body." + e.getMessage());
    }
}
Also used : AutomatorException(com.testsigma.automator.exceptions.AutomatorException)

Example 40 with AutomatorException

use of com.testsigma.automator.exceptions.AutomatorException in project testsigma by testsigmahq.

the class RestAPIRunTimeDataProcessor method updateRequestHeadersRuntimeValues.

private void updateRequestHeadersRuntimeValues() throws AutomatorException {
    log.debug("Updating header run time data for Rest Step:" + restfulStepEntity.getId());
    try {
        String updatedRequestHeaders = replaceRuntimeVariables(restfulStepEntity.getRequestHeaders());
        restfulStepEntity.setRequestHeaders(updatedRequestHeaders);
    } catch (AutomatorException e) {
        throw new AutomatorException("Error while replacing runtime variables in request Headers." + e.getMessage());
    }
}
Also used : AutomatorException(com.testsigma.automator.exceptions.AutomatorException)

Aggregations

AutomatorException (com.testsigma.automator.exceptions.AutomatorException)119 TimeoutException (org.openqa.selenium.TimeoutException)31 WebElement (org.openqa.selenium.WebElement)19 IOException (java.io.IOException)12 ArrayList (java.util.ArrayList)9 Select (org.openqa.selenium.support.ui.Select)6 TestsigmaException (com.testsigma.agent.exception.TestsigmaException)5 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)3 RuntimeDataProvider (com.testsigma.automator.utilities.RuntimeDataProvider)3 InvocationTargetException (java.lang.reflect.InvocationTargetException)3 Map (java.util.Map)3 RemoteWebDriver (org.openqa.selenium.remote.RemoteWebDriver)3 LinkedMultiValueMap (org.springframework.util.LinkedMultiValueMap)3 PathNotFoundException (com.jayway.jsonpath.PathNotFoundException)2 ElementNotDisplayedException (com.testsigma.automator.actions.exceptions.ElementNotDisplayedException)2 MobileApp (com.testsigma.automator.mobile.MobileApp)2 ObjectMapperService (com.testsigma.automator.service.ObjectMapperService)2 ErrorUtil (com.testsigma.automator.utilities.ErrorUtil)2 File (java.io.File)2 MalformedURLException (java.net.MalformedURLException)2