We use cookies to enhance user experience, analyze site usage, and assist in our marketing efforts. By continuing to browse or closing this banner, you acknowledge that you have read and agree to our Cookie Policy, Privacy Policy and Terms of Service.

Browserstack logo
  • Live for Teams
  • Pricing
    • Test your websites
    • Live
      Manual cross-browser testing
    • Automate
      Browser automation grid
    • Percy
      Visual testing & review
    • Accessibility Testing
      Super app to find & report issues
    • Test your mobile apps
    • App Live
      Manual real device testing
    • App Automate
      Real device automation grid
    • App Percy
      Visual testing for mobile apps
    • Test management & optimization
    • Test Management
      Unify & track all test cases
    • Test Observability
      Smart test reporting & debugging
    • Test development
    • Nightwatch.js
      End-to-End testing framework

    Use BrowserStack with your favourite products. See our Integrations ⟶

    • For Teams
    • Enterprise
    • Tools
    • Screenshots
    • Responsive
    • SpeedLab
    • Documentation
    • Support
    • Status
    • Release Notes
    • Open Source
    • Events
    • Champions
  • Live for Teams
  • Pricing
  • Sign in
  • Free Trial
  • Test your websites
  • Live
    Manual cross-browser testing
  • Automate
    Browser automation grid
  • Percy
    Visual testing & review
  • Accessibility Testing
    Super app to find & report issues
  • Test your mobile apps
  • App Live
    Manual real device testing
  • App Automate
    Real device automation grid
  • App Percy
    Visual testing for mobile apps
  • Test management & optimization
  • Test Management
    Unify & track all test cases
  • Test Observability
    Smart test reporting & debugging
  • Test development
  • Nightwatch.js
    End-to-End testing framework
  • For Teams
  • Enterprise
  • Tools
  • Screenshots
  • Responsive
  • SpeedLab
  • Documentation
  • Support
  • Status
  • Release Notes
  • Open Source
  • Events
  • Champions
  • Get help
  • Selenium documentation
  • NodeJS
  • Java
  • Python
  • C#
  • Ruby
  • Perl
  • PHP
  • WebdriverIO
  • Protractor
  • Nightwatch
  • JUnit
  • Test dev environments
  • Jenkins
  • References
  • Selenium Capabilities
  • Browsers & Devices
  • Continuous Integration (CI)
  • REST API
  • Status
  • Other frameworks
  • Cypress
  • Playwright
  • Puppeteer
  • JS Testing API
    Home Documentation Automate Selenium 4

    Getting Started with Selenium 4

    Learn about the key changes coming with Version 4 of Selenium and the changes you need to make to your test suite.

    Introduction

    Selenium 4 is launching soon, with that Selenium Webdriver will be completely W3C standardized. Browsers such as Chrome, Safari, Firefox, Internet Explorer and Edge will also follow W3C standardization, therefore browser drivers will interact with Selenium WebDriver in W3C standard protocol.
    The capabilities format will change in the new standard.

    Why are these changes being made?

    To bring in standard and stability. Few selenium commands work differently on different browsers. As a user, you have to modify your code to deal with those changes. This will bring in standard and stability and will not require you to modify your code to work with different browsers.

    What does it mean to me?

    The short answer is that your tests will continue to work. BrowserStack is backward compatible to support Selenium 4. We have ensured backward compatibility of most of the Selenium commands. As Selenium 4 is released, browsers will turn off support for legacy JSONWire protocol. Few commands such as /touch will fail on the latest browser versions. You should switch to the latest Selenium WebDriver version to avoid any impact and continue using the latest browser and driver versions. By using the latest Selenium version you can stay ahead and use all the new features of Selenium 4.

    Refer to Capabilities Generator for a complete list of capabilities and code generator.

    Updating your Selenium test suite

    Use the Selenium language binding versions that support the new W3C protocol. Download the language bindings from Selenium HQ. When you start a session, you set Selenium capabilities and BrowserStack specific capabilities. The capability format has changed.

    You can review and generate all Selenium and BrowserStack capabilities in W3C format with our Capabilities Generator.

    Updating standard Selenium capabilities

    The capability format for Selenium 4 has changed. For example, "version" is now passed as "browserVersion". Refer here for the list of supported capabilities in Selenium 4. The Selenium WebDriver will drop any unsupported capability.

    Changes in Selenium capabilities names:

    Legacy/JSONWire Protocol WebDriver Protocol
    version browserVersion
    platform platformName
    acceptSslCerts acceptInsecurecerts
    - pageLoadStratergy
    - setWindowRect
    - timeouts
    - strictFileInteractability
    - unhandledPromptBehavior

    Updating BrowserStack custom capabilities

    BrowserStack capabilities need to be set in "bstack:options" key. There are changes in the capabilities format. For example "browserstack.user" will be passed as "userName" and "browserstack.key" will be passed as "accessKey". BrowserStack also supports browser specific configuration such as using a custom driver version. Such a capability needs to be set inside "bstack:options" hash, with key as "chrome", "firefox", "ie", "edge" or "safari".

    List of frequently used BrowserStack capabilities.

    Legacy/JSONWire Protocol WebDriver Protocol
    browserstack.user userName
    name sessionName
    browserstack.selenium_version seleniumVersion
    project projectName
    os_version osVersion
    os os
    browserstack.local local
    build buildName
    browserstack.key accessKey

    Refer capability builder for the complete list

    Example

    Refer the below section on how capabilities are passed now, and with W3C protocol.

    Legacy Protocol

                                    
    DesiredCapabilities caps = new DesiredCapabilities();
    caps.setCapability("os", "Windows");
    caps.setCapability("os_version", "10");
    caps.setCapability("browser", "Chrome");
    caps.setCapability("browser_version", "70.0");
    caps.setCapability("project", "PROJECT_NAME");
    caps.setCapability("build", "BUILD_NAME");
    caps.setCapability("name", "SESSION_NAME");
    caps.setCapability("browserstack.local", "true");
    caps.setCapability("browserstack.debug", "true");
    caps.setCapability("browserstack.console", "info");
    caps.setCapability("browserstack.networkLogs", "true");
    caps.setCapability("browserstack.chrome.driver", "2.45");
    caps.setCapability("browserstack.user", "USERNAME");
    caps.setCapability("browserstack.key", "ACCESS_KEY");
                                
                                    
    var capabilities = {
        'os' : 'Windows',
        'os_version' : '10',
        'browserName' : 'Chrome',
        'browser_version' : '70.0',
        'project' : 'PROJECT_NAME',
        'build' : 'BUILD_NAME',
        'name' : 'SESSION_NAME',
        'browserstack.local' : 'true',
        'browserstack.debug' : 'true',
        'browserstack.console' : 'info',
        'browserstack.networkLogs' : 'true',
        'browserstack.chrome.driver' : '2.45',
        'browserstack.user' : 'USERNAME',
        'browserstack.key' : 'ACCESS_KEY'
    }
    
                                
                                    
    desired_cap = {
        'os' : 'Windows',
        'os_version' : '10',
        'browser' : 'Chrome',
        'browser_version' : '70.0',
        'project' : 'PROJECT_NAME',
        'build' : 'BUILD_NAME',
        'name' : 'SESSION_NAME',
        'browserstack.local' : 'true',
        'browserstack.debug' : 'true',
        'browserstack.console' : 'info',
        'browserstack.networkLogs' : 'true',
        'browserstack.chrome.driver' : '2.45',
        'browserstack.user' : 'USERNAME',
        'browserstack.key' : 'ACCESS_KEY'
    }
    
                                
                                    
    DesiredCapabilities capability = new DesiredCapabilities();
    capability.SetCapability("os", "Windows");
    capability.SetCapability("os_version", "10");
    capability.SetCapability("browser", "Chrome");
    capability.SetCapability("browser_version", "70.0");
    capability.SetCapability("project", "PROJECT_NAME");
    capability.SetCapability("build", "BUILD_NAME");
    capability.SetCapability("name", "SESSION_NAME");
    capability.SetCapability("browserstack.local", "true");
    capability.SetCapability("browserstack.debug", "true");
    capability.SetCapability("browserstack.console", "info");
    capability.SetCapability("browserstack.networkLogs", "true");
     
    capability.SetCapability("browserstack.chrome.driver", "2.45");
    capability.SetCapability("browserstack.user", "USERNAME");
    capability.SetCapability("browserstack.key", "ACCESS_KEY");
    
                                
                                    
    $caps = array(
        "os" => "Windows",
        "os_version" => "10",
        "browser" => "Chrome",
        "browser_version" => "70.0",
        "project" => "PROJECT_NAME",
        "build" => "BUILD_NAME",
        "name" => "SESSION_NAME",
        "browserstack.local" => "true",
        "browserstack.debug" => "true",
        "browserstack.console" => "info",
        "browserstack.networkLogs" => "true",
        "browserstack.chrome.driver" => "2.45",
        "browserstack.user" => "USERNAME",
        "browserstack.key" => "ACCESS_KEY"
    )
    
                                
                                    
    caps = Selenium::WebDriver::Remote::Capabilities.new
    caps["os"] = "Windows"
    caps["os_version"] = "10"
    caps["browser"] = "Chrome"
    caps["browser_version"] = "70.0"
    caps["project"] = "PROJECT_NAME"
    caps["build"] = "BUILD_NAME"
    caps["name"] = "SESSION_NAME"
    caps["browserstack.local"] = "true"
    caps["browserstack.debug"] = "true"
    caps["browserstack.console"] = "info"
    caps["browserstack.networkLogs"] = "true"
    caps["browserstack.chrome.driver"] = "2.45"
    caps["browserstack.user"] = "USERNAME"
    caps["browserstack.key"] = "ACCESS_KEY"
    
                                
                                    
    my $extraCaps = {
        "os" => "Windows",
        "os_version" => "10",
        "browser" => "Chrome",
        "browser_version" => "70.0",
        "project" => "PROJECT_NAME",
        "build" => "BUILD_NAME",
        "name" => "SESSION_NAME",
        "browserstack.local" => "true",
        "browserstack.debug" => "true",
        "browserstack.console" => "info",
        "browserstack.networkLogs" => "true",
        "browserstack.chrome.driver" => "2.45",
        "browserstack.user" => "USERNAME",
        "browserstack.key" => "ACCESS_KEY"
    }
    
                                

    W3C Protocol

                                    
    DesiredCapabilities capabilities = new DesiredCapabilities();
    capabilities.setCapability("browserName", "Chrome");
    capabilities.setCapability("browserVersion", "70.0");
    HashMap<String, Object> browserstackOptions = new HashMap<String, Object>();
    browserstackOptions.put("os", "Windows");
    browserstackOptions.put("osVersion", "10");
    browserstackOptions.put("projectName", "PROJECT_NAME");
    browserstackOptions.put("buildName", "BUILD_NAME");
    browserstackOptions.put("sessionName", "SESSION_NAME");
    browserstackOptions.put("local", "true");
    browserstackOptions.put("debug", "true");
    browserstackOptions.put("consoleLogs", "info");
    browserstackOptions.put("networkLogs", "true");
    browserstackOptions.put("browserstack", browserstackOptions);
    HashMap<String, Object> chromeOptions = new HashMap<String, Object>();
    chromeOptions.put("driver", "2.45");
    browserstackOptions.put("chrome", chromeOptions);
    capabilities.setCapability("bstack:options", browserstackOptions);
    
                                
                                    
    var capabilities = {
        'browserName': 'Chrome',
        'browserVersion': '70.0',
        'bstack:options': {
            'os': 'Windows',
            'osVersion': '10',
            'projectName': 'PROJECT_NAME',
            'buildName': 'BUILD_NAME',
            'sessionName': 'SESSION_NAME',
            'local': 'true',
            'debug': 'true',
            'consoleLogs': 'info',
            'networkLogs': 'true',
            'userName': 'USERNAME',
            'accessKey': 'ACCESS_KEY',
            'chrome': {
                'driver': '2.45',
            }
        }
    }
    
                                
                                    
    desired_cap = {
        'browserName' : 'Chrome',
        'browserVersion' : '70.0',
        'bstack:options' : {
            'os' : 'Windows',
            'osVersion' : '10',
            'projectName' : 'PROJECT_NAME',
            'buildName' : 'BUILD_NAME',
            'sessionName' : 'SESSION_NAME',
            'local' : 'true',
            'debug' : 'true',
            'consoleLogs' : 'info',
            'networkLogs' : 'true',
            'userName' : 'USERNAME',
            'accessKey' : 'ACCESS_KEY',
            'chrome' : {
                'driver' : '2.45',
            }
        }
     
    }
    
                                
                                    
    DesiredCapabilities capabilities = new DesiredCapabilities();
    capabilities.setCapability("browserName", "Chrome");
    capabilities.setCapability("browserVersion", "70.0");
    Dictionary<string, object> .browserstackOptions = new Dictionary<string, object>();
    browserstackOptions.Add("os", "Windows");
    browserstackOptions.Add("osVersion", "10");
    browserstackOptions.Add("projectName", "PROJECT_NAME");
    browserstackOptions.Add("buildName", "BUILD_NAME");
    browserstackOptions.Add("sessionName", "SESSION_NAME");
    browserstackOptions.Add("local", "true");
    browserstackOptions.Add("debug", "true");
    browserstackOptions.Add("consoleLogs", "info");
    browserstackOptions.Add("networkLogs", "true");
    browserstackOptions.Add("userName", "USERNAME");
    browserstackOptions.Add("accessKey", "ACCESS_KEY");
    browserstackOptions.Add("browserstack", browserstackOptions);
    Dictionary<string, object> .chromeOptions = new Dictionary<string, object>();
    chromeOptions.Add("driver", "2.45");
    browserstackOptions.Add("chrome", chromeOptions);
    capabilities.setCapability("bstack:options", browserstackOptions);
    
                                
                                    
    $caps = array(
        "browserName" => "Chrome",
        "browserVersion" => "70.0",
        'bstack:options' => array(
            "os" => "Windows",
            "osVersion" => "10",
            "projectName" => "PROJECT_NAME",
            "buildName" => "BUILD_NAME",
            "sessionName" => "SESSION_NAME",
            "local" => "true",
            "debug" => "true",
            "consoleLogs" => "info",
            "networkLogs" => "true",
            "browserstack.user" => "USERNAME",
            "browserstack.key" => "ACCESS_KEY",
            'chrome' => (
                "driver" => "2.45",
            )
        )
    )
    
                                
                                    
    capabilities = {
        'browserName' => 'Chrome',
        'browserVersion' => '70.0',
        'bstack:options' => {
            'os' => 'Windows',
            'osVersion' => '10',
            'projectName' => 'PROJECT_NAME',
            'buildName' => 'BUILD_NAME',
            'sessionName' => 'SESSION_NAME',
            'local' => 'true',
            'debug' => 'true',
            'consoleLogs' => 'info',
            'networkLogs' => 'true',
            'userName' => 'USERNAME',
            'accessKey' => 'ACCESS_KEY',
            'chrome' => {
                'driver' => '2.45',
            }
        }
         
    }
    
                                
                                    
    my $extraCaps = {
        "browserName" => "Chrome",
        "browserVersion" => "70.0",
        'bstack:options' => {
            "os" => "Windows",
            "osVersion" => "10",
            "projectName" => "PROJECT_NAME",
            "buildName" => "BUILD_NAME",
            "sessionName" => "SESSION_NAME",
            "local" => "true",
            "debug" => "true",
            "consoleLogs" => "info",
            "networkLogs" => "true",
            "userName" => "USERNAME",
            "accessKey" => "ACCESS_KEY",
            'chrome' => {
                "driver" => "2.45",
            }
        }  
    }
    
                                

    In This Article

    • Introduction
    • Why are the changes being made
    • What does it mean to me
    • Updating the Selenium tests
      • Updating Selenium capabilities
      • Updating BrowserStack capabilities
    • Examples

    Related Articles

    Capabilities

    Products

    • Live
    • Automate
    • Percy
    • App Live
    • App Automate
    • App Percy New
    • Test Management Beta
    • Test Observability Beta
    • Accessibility Testing Beta
    • Nightwatch
    • Enterprise

    Tools

    • SpeedLab
    • Screenshots
    • Responsive

    Platform

    • Browsers & Devices
    • Data Centers
    • Device Features
    • Security

    Solutions

    • Test on iPhone
    • Test on iPad
    • Test on Galaxy
    • Test In IE
    • Android Testing
    • iOS Testing
    • Cross Browser Testing
    • Emulators & Simulators
    • Selenium
    • Cypress
    • Android Emulators
    • Visual Testing

    Resources

    • Test on Right Devices
    • Support
    • Status
    • Release Notes
    • Case Studies
    • Blog
    • Events
    • Test UniversityBeta
    • Champions
    • Mobile Emulators
    • Guide
    • Responsive Design

    Company

    • About Us
    • Customers
    • Careers We're hiring!
    • Open Source
    • Partners
    • Press
    BrowserStack Logo An illustrated of BrowserStack Logo

    Social

    • BrowserStack Twitter Account An illustrated of white twitter Logo
    • BrowserStack FaceBook Account An illustrated of white FaceBook Logo
    • BrowserStack LinkedIn Account An illustrated of white LinkedIn Logo
    • BrowserStack Youtube Channel An illustrated of white youtube Logo
    • BrowserStack Instagram Account An illustrated of white instagram Logo
    BrowserStack Contact Us Icon An illustration of white contact us icon Contact Us

    © 2023 BrowserStack. All rights reserved.

    • Terms of Service
    • Privacy Policy
    • Cookie Policy
    • Sitemap