Cross-Browser Testing and Cloud Providers

Selenium 12 min min read Updated: Nov 16, 2026 Advanced
Cross-Browser Testing and Cloud Providers
Advanced Topic 5 of 5

Why Cross-Browser Testing?

Chrome, Firefox, Safari and Edge render pages and run JavaScript slightly differently. A feature that works in Chrome can break in Safari. Cross-browser tests give you confidence that real users on other browsers can use the site.

What to Test

  • Run smoke tests on all browsers
  • Run the full suite on your main browser (Chrome)
  • Choose browsers by your site's analytics (what your users really use)
  • Test mobile layouts at least with emulated sizes and a few real devices

Run the Same Test on Several Browsers

python # conftest.py import pytest BROWSERS = ["chrome", "firefox", "edge"] def pytest_generate_tests(metafunc): if "browser_name" in metafunc.fixturenames: metafunc.parametrize("browser_name", BROWSERS) @pytest.fixture def driver(browser_name): drv = create_driver(browser_name, headless=True) yield drv drv.quit() # tests/test_smoke.py def test_title(driver, browser_name): driver.get("https://the-internet.herokuapp.com/") assert "The Internet" in driver.title

Cloud Providers

Cloud providers give you thousands of real browser and device combinations, including Safari on macOS and real iPhones, without buying or maintaining hardware.

ProviderKnown for
BrowserStackLarge number of real devices and browsers
Sauce LabsStrong enterprise features and analytics
LambdaTestAffordable plans and parallel runs
Self-hosted GridFree, full control, you maintain it

Example: BrowserStack (W3C Capabilities)

python import os from selenium import webdriver from selenium.webdriver.chrome.options import Options options = Options() options.set_capability("browserName", "Chrome") options.set_capability("bstack:options", { "os": "Windows", "osVersion": "11", "browserVersion": "latest", "sessionName": "Smoke - home page", "buildName": "build-2026-11-16", "userName": os.environ["BROWSERSTACK_USERNAME"], "accessKey": os.environ["BROWSERSTACK_ACCESS_KEY"], }) driver = webdriver.Remote(command_executor="https://hub.browserstack.com/wd/hub", options=options)
Check the provider docs: Capability names and URLs differ by provider and change over time. Always copy the current example from the provider's capability generator page.

Mark Test Status in the Dashboard

python # after the test (in the fixture teardown) status = "passed" if not failed else "failed" driver.execute_script( 'browserstack_executor: {"action": "setSessionStatus", "arguments": {"status":"%s","reason":"%s"}}' % (status, "Test finished"))

Testing a Local or Staging Site

Cloud browsers cannot see localhost. Providers offer a tunnel program (such as BrowserStack Local or Sauce Connect) that opens a secure connection from the cloud browser to your private site.

Control Cost and Time

  • Run only smoke tests on every browser, not the full suite
  • Run cloud tests nightly or before release
  • Quit sessions always (quit()) so they do not stay open
  • Use the number of parallel sessions that your plan allows
Good habit: Keep one create_driver() function. Local, Grid and cloud differ only in the options and the URL, so your tests never change.

Conclusion

Parametrize the browser for cross-browser coverage, choose browsers from real user data and use a cloud provider or Grid when you need many combinations or real devices.

Quick Summary: Same tests, different driver factory options; cloud = Remote + provider capabilities.

Get Newsletter

Subscibe to our newsletter and we will notify you about the newest updates on Edugators