Headless mode

Mobitru supports the headless mode for playwright browser session’s, which allows to have faster and more reliable test execution.
This feature is available for all browsers and switched ON by default.

Manage in tests

To change the default state of the headless mode, it’s necessary to add the headless parameter to a WebSocket endpoint.
The parameter should contain true or false value in order to enable or disable the mode.
Important note: the Playwright supports capturing screenshots, video recordings, and logs even in headless mode.
It means, all report artifacts will be available even without the GUI loaded.
Below you can find an example for different programming languages:

const playwright = require('playwright-core');

const mobitruHost = "browserhub-us.mobitru.com";
const mobitruTeamCode = "<TEAM_CODE>";
const mobitruAccessToken = "mobitru_ak...";
const pwVersion = "1.55.0";
const mobitruLandingUrl = 'https://mobitru.com/';
const browserName = 'chrome';


    test.describe(`Demo test`, () => {
       ....

        test.beforeAll(async ({}, testInfo) => {
            const wsEndpoint = `wss://${mobitruTeamCode}:${mobitruAccessToken}@${mobitruHost}/playwright/${browserName}/playwright-${pwVersion}?headless=false`;
        
            ....
        });
        
       ....
private static final String PROJECT_NAME = "<TEAM_CODE>";
private static final String API_KEY = "mobitru_ak_...";
private static final String BROWSER_HUB = "browserhub-us.mobitru.com";
private static final String BROWSER_NAME = "chrome";
private static final String PW_VERSION = "1.54.0";

@Test
public void demoTest() {
        String wsEndpoint = String.format("wss://%s:%s@%s/playwright/%s/playwright-%s?headless=false",
                PROJECT_NAME, API_KEY, BROWSER_HUB, BROWSER_NAME, PW_VERSION);

        ....
    }
import pytest

from playwright.sync_api import sync_playwright, Page, expect

BILLING_UNIT = '<TEAM_CODE>'
ACCESS_TOKEN = 'mobitru_ak_...'
MOBITRU_HOST = 'browserhub-us.mobitru.com'
BROWSER_NAME = 'chrome'
PW_VERSION = '1.55.0'


@pytest.fixture(scope="function")
def mobitru_page(request):
    with sync_playwright() as playwright:
        chromium = playwright.chromium
        ws_endpoint = f"wss://{BILLING_UNIT}:{ACCESS_TOKEN}@{MOBITRU_HOST}/playwright/{BROWSER_NAME}/playwright-{PW_VERSION}?headless=false"
        ....        

private const string PROJECT_NAME = "<TEAM_CODE>";
private const string API_KEY = "mobitru_ak_....";
private const string BROWSER_HUB = "browserhub-us.mobitru.com";
private const string BROWSER_NAME = "chrome";
private const string PW_VERSION = "1.55.0";

[Test]
public void DemoTest()
{
    string wsEndpoint = $"wss://{PROJECT_NAME}:{API_KEY}@{BROWSER_HUB}/playwright/{BROWSER_NAME}/playwright-{PW_VERSION}?headless=false";
    ....
}

Scroll to Top