Search in sources :

Example 6 with WebDriverCapability

use of com.testsigma.automator.drivers.WebDriverCapability in project testsigma by testsigmahq.

the class FirefoxDriver method setTestsigmaLabCapabilities.

@Override
public void setTestsigmaLabCapabilities() throws AutomatorException {
    if (!"Linux".equals(getPlatform())) {
        MutableCapabilities mutableCapabilities = new MutableCapabilities();
        mutableCapabilities.setCapability(TSCapabilityType.SELENIUM_VERSION, "3.8.1");
        mutableCapabilities.setCapability(TSCapabilityType.NAME, executionName);
        mutableCapabilities.setCapability(EnvSettingsConstants.KEY_MAX_IDLE_TIME, EnvSettingsConstants.MAX_IDLE_TIME);
        mutableCapabilities.setCapability(EnvSettingsConstants.KEY_MAX_DURATION, EnvSettingsConstants.MAX_DURATION);
        mutableCapabilities.setCapability("username", this.getTestDeviceEntity().getUsername());
        mutableCapabilities.setCapability("accessKey", this.getTestDeviceEntity().getAccessKey());
        capabilities.add(new WebDriverCapability(TSCapabilityType.TESTSIGMA_LAB_OPTIONS, mutableCapabilities));
        setTestsigmaLabRemoteServerUrl();
    } else {
        super.setTestsigmaLabCapabilities();
    }
    capabilities.add(new WebDriverCapability(CapabilityType.BROWSER_NAME, BrowserType.FIREFOX));
}
Also used : WebDriverCapability(com.testsigma.automator.drivers.WebDriverCapability) MutableCapabilities(org.openqa.selenium.MutableCapabilities)

Example 7 with WebDriverCapability

use of com.testsigma.automator.drivers.WebDriverCapability in project testsigma by testsigmahq.

the class WebDriver method setCommonCapabilities.

@Override
protected void setCommonCapabilities() throws AutomatorException {
    super.setCommonCapabilities();
    capabilities.add(new WebDriverCapability(TSCapabilityType.NAME, executionName));
    capabilities.add(new WebDriverCapability(TSCapabilityType.ACCEPT_SSL_CERTS, Boolean.TRUE));
    capabilities.add(new WebDriverCapability(TSCapabilityType.UNHANDLED_PROMPT_BEHAVIOUR_KEY, TSCapabilityType.UNHANDLED_PROMPT_BEHAVIOUR_VALUE));
}
Also used : WebDriverCapability(com.testsigma.automator.drivers.WebDriverCapability)

Example 8 with WebDriverCapability

use of com.testsigma.automator.drivers.WebDriverCapability in project testsigma by testsigmahq.

the class DriverSessionsService method createSession.

public String createSession(DriverSessionRequest driverSessionRequest) throws Exception {
    com.testsigma.agent.dto.WebDriverSettingsDTO webDriverSettingsDTO;
    if (ExecutionLabType.Hybrid.equals(driverSessionRequest.getExecutionLabType()) && WorkspaceType.isMobileApp(driverSessionRequest.getWorkspaceType())) {
        disconnectDeviceSession(driverSessionRequest.getUniqueId());
        driverSessionRequest.setWebDriverServerUrl(new URL(mobileAutomationServer.getServerURL()));
    }
    webDriverSettingsDTO = fetchWebDriverSettings(driverSessionRequest);
    log.info("Creating a remote web driver session with settings - " + webDriverSettingsDTO);
    TestsigmaDriver testsigmaDriver = getDriverInstance(driverSessionRequest);
    List<WebDriverCapability> caps = webDriverSettingsDTO.getWebDriverCapabilities();
    addMissingTimeOutCapability(caps);
    handleLocalDevice(caps, driverSessionRequest);
    setRemoteServerURL(testsigmaDriver, driverSessionRequest, webDriverSettingsDTO);
    testsigmaDriver.setCapabilities(caps);
    RemoteWebDriver remoteWebDriver = testsigmaDriver.createSession();
    String sessionId = populateSessionIdMaps(remoteWebDriver, driverSessionRequest);
    sendMobileSessionStartedRequest(sessionId, driverSessionRequest);
    return sessionId;
}
Also used : WebDriverCapability(com.testsigma.automator.drivers.WebDriverCapability) RemoteWebDriver(org.openqa.selenium.remote.RemoteWebDriver) TestsigmaDriver(com.testsigma.automator.drivers.TestsigmaDriver) URL(java.net.URL) WebDriverSettingsDTO(com.testsigma.agent.dto.WebDriverSettingsDTO)

Example 9 with WebDriverCapability

use of com.testsigma.automator.drivers.WebDriverCapability in project testsigma by testsigmahq.

the class DriverSessionsService method appendChromeDriverExecutable.

private void appendChromeDriverExecutable(List<WebDriverCapability> caps, DriverSessionRequest driverSessionRequest) throws TestsigmaException {
    MobileDevice device = deviceContainer.getDevice(driverSessionRequest.getUniqueId());
    if (device.getBrowserList() != null && device.getBrowserList().size() > 0) {
        AgentBrowser browser = device.getBrowserList().get(0);
        File chromePath = driverExecutableExists(Browsers.GoogleChrome.getKey(), browser.getMajorVersion() + "");
        if (chromePath != null) {
            WebDriverCapability cap = new WebDriverCapability(TSCapabilityType.CHROME_DRIVER_EXECUTABLE, chromePath.getAbsolutePath());
            caps.add(cap);
        } else {
            log.warn("Chrome Driver is not yet downloaded.. please try after some time");
        }
    }
}
Also used : AgentBrowser(com.testsigma.agent.browsers.AgentBrowser) WebDriverCapability(com.testsigma.automator.drivers.WebDriverCapability) File(java.io.File)

Example 10 with WebDriverCapability

use of com.testsigma.automator.drivers.WebDriverCapability in project testsigma by testsigmahq.

the class DriverSessionsService method setupIosDevice.

public void setupIosDevice(List<WebDriverCapability> caps, DriverSessionRequest driverSessionRequest) throws TestsigmaException, AutomatorException {
    MobileDevice device = deviceContainer.getDevice(driverSessionRequest.getUniqueId());
    iosDeviceService.setupWda(device);
    WebDriverCapability bundleIdCapability = caps.stream().filter(cap -> cap.getCapabilityName().equals(TSCapabilityType.BUNDLE_ID)).findFirst().orElse(null);
    if ((bundleIdCapability == null) || StringUtils.isBlank((String) bundleIdCapability.getCapabilityValue())) {
        WebDriverCapability appCapability = caps.stream().filter(cap -> cap.getCapabilityName().equals(MobileCapabilityType.APP)).findFirst().orElse(null);
        AppPathType appPathType = driverSessionRequest.getApplicationPathType();
        if ((appCapability != null) && appPathType != AppPathType.APP_DETAILS) {
            caps.remove(appCapability);
            String appPresignedUrl = (String) appCapability.getCapabilityValue();
            String bundleId = iosDeviceService.installApp(device, appPresignedUrl);
            caps.add(new WebDriverCapability(TSCapabilityType.BUNDLE_ID, bundleId));
        }
    }
}
Also used : WebDriverCapability(com.testsigma.automator.drivers.WebDriverCapability)

Aggregations

WebDriverCapability (com.testsigma.automator.drivers.WebDriverCapability)15 File (java.io.File)2 Map (java.util.Map)2 AgentBrowser (com.testsigma.agent.browsers.AgentBrowser)1 WebDriverSettingsDTO (com.testsigma.agent.dto.WebDriverSettingsDTO)1 TestsigmaDriver (com.testsigma.automator.drivers.TestsigmaDriver)1 AppPathType (com.testsigma.automator.entity.AppPathType)1 AppInstaller (com.testsigma.automator.mobile.ios.AppInstaller)1 URL (java.net.URL)1 List (java.util.List)1 MutableCapabilities (org.openqa.selenium.MutableCapabilities)1 ChromeOptions (org.openqa.selenium.chrome.ChromeOptions)1 FirefoxProfile (org.openqa.selenium.firefox.FirefoxProfile)1 RemoteWebDriver (org.openqa.selenium.remote.RemoteWebDriver)1