Table of Contents

Class BrowserConfiguration

Namespace
Xping.Sdk.Core.Clients.Browser
Assembly
Xping.Sdk.Core.dll
public class BrowserConfiguration : BaseConfiguration
Inheritance
BrowserConfiguration
Inherited Members

Properties

BrowserType

Gets or sets a value which specifies the browser type to use for the web tests. It can be one of the values from the BrowserType enum in the Playwright library, such as “chromium”, “firefox”, or “webkit”. The default value is “chromium”.

public string BrowserType { get; set; }

Property Value

string

Remarks

The BrowserType property is used by to create a new browser instance of the specified type. For example, you can set this property as follows

var settings = new TestSettings
{
    BrowserType = BrowserType.Firefox;
}

Headless

Whether to run browser in headless mode. More details for Chromium and Firefox. Defaults to true.

public bool? Headless { get; set; }

Property Value

bool?

Locale

Specify user locale, for example en-GB, de-DE, etc. Locale will affect navigator.language value, Accept-Language request header value as well as number and date formatting rules. Defaults to the system default locale. Learn more about emulation in our emulation guide.

public string? Locale { get; set; }

Property Value

string

WaitUntil

When to consider operation succeeded, defaults to load. Events can be either:

  • 'domcontentloaded' - consider operation to be finished when the DOMContentLoaded event is fired.
  • 'load' - consider operation to be finished when the load event is fired.
  • 'networkidle' - **DISCOURAGED** consider operation to be finished when there are no network connections for at least 500 ms. Don't use this method for testing, rely on web assertions to assess readiness instead.
  • 'commit' - consider operation to be finished when network response is received and the document started loading.
public WaitUntilState? WaitUntil { get; set; }

Property Value

WaitUntilState?

Methods

ClearGeolocation()

Removes the geolocation information from the test settings instance.

public void ClearGeolocation()

Remarks

This method clears any stored geolocation data associated with the Geolocation key in the PropertyBag. It is useful for resetting the test environment or ensuring that no location data persists between tests.

GetGeolocation()

Retrieves the geolocation coordinates from the test settings instance.

public Geolocation? GetGeolocation()

Returns

Geolocation

A Geolocation object containing latitude and longitude coordinates if found; otherwise, null.

Remarks

This method attempts to retrieve the Geolocation object associated with the current test settings. If the PropertyBag contains the Geolocation key, the method will return the corresponding Geolocation object; otherwise, it will return null, indicating that no geolocation has been set.

SetGeolocation(Geolocation)

Stores the geolocation coordinates in the test settings instance for use with a headless browser.

public void SetGeolocation(Geolocation geolocation)

Parameters

geolocation Geolocation

The Geolocation object containing latitude and longitude coordinates.

Remarks

note

Note that this method is not applicable for setting geolocation in an HttpClient instance, as HttpClient does not inherently support geolocation.

This method updates the PropertyBag with the provided Geolocation object. If the Geolocation key already exists, it will be updated with the new coordinates; otherwise, a new entry will be added. This is particularly useful for setting up location-based scenarios in automated tests using a headless browser.