TestProject Forum

Targeting different platforms using WebDriver

I am a newbie and saw samples of executing WebDriver tests on different platforms by just targeting these for the capabilities of the browser or OS.

capability= DesiredCapabilities.firefox();
capability.setBrowserName(“firefox”);
capability.setPlatform(org.openqa.selenium.Platform.ANY);

capability= DesiredCapabilities.internetExplorer();
capability.setBrowserName(“iexplore”);
capability.setPlatform(org.openqa.selenium.Platform.WINDOWS);

Is it possible to run tests and verify on different OS and Browsers just by using the libraries provided by the Selenium?

Hello @soumyaranjan.intelli,

For executing TestProject tests on different remote platforms and browsers, you can use the TestProject openSDK which provides the ability to code your tests to be executed on remote drivers for cloud providers such as SauceLabs or BrowserStack.

Your TestProject account should be integrated with BrowserStack or SauceLabs: https://app.testproject.io/#/integrations/cloud-executions

A custom capability cloud:URL should be set, for example:

import io.testproject.sdk.drivers.TestProjectCapabilityType;
import io.testproject.sdk.drivers.web.RemoteWebDriver;
import org.openqa.selenium.remote.DesiredCapabilities;

public final class Example {

    public static void main(final String[] args) throws Exception {


        DesiredCapabilities caps = new DesiredCapabilities();
        caps.setCapability(
                TestProjectCapabilityType.CLOUD_URL,
                "https://{USERNAME}:{PASSWORD}@ondemand.us-west-1.saucelabs.com:443/wd/hub");
        caps.setCapability("browserName", "chrome");
        caps.setCapability("version", "77.0");
        caps.setCapability("platform", "win10"); 
        RemoteWebDriver driver = new RemoteWebDriver("{TP_DEV_TOKEN}", caps);

            ..
            ..
            ..

Once the test execution finished, its reports will be automatically generated to the TestProject platform under your account.