Verisoft Wiki

Overview:

Verisoft Framework now supports a new feature that allows injecting custom headers directly into the Verisoft Driver.

This feature is applicable for both Web and Appium tests, providing enhanced capability for security, monitoring, and other purposes. Custom headers can be added to tests running on a remote driver.

Usage:

To use this feature in your test, you can utilize the @CustomHeaders annotation. This allows you to define custom headers that will be injected into the HTTP requests made by the Verisoft Driver.

Example:

Below is an example of how to implement custom headers in a test:

import co.verisoft.fw.selenium.drivers.factory.CustomHeaders;
import org.junit.jupiter.api.Test;
import org.openqa.selenium.WebDriver;

import java.util.HashMap;
import java.util.Map;

public class CustomHeadersTest {

    @CustomHeaders
    // Define custom headers 
    Map<String, String> headers = new HashMap<>();
    {
        headers.put("SomeHeader", "SomeValue");
    }
    
    @DriverCapabilities
    private DesiredCapabilities capabilities = new DesiredCapabilities();
    {
        capabilities.setCapability("browserName", "chrome");
        capabilities.setCapability("browserVersion", "113");
        capabilities.setCapability("enableVNC", true); // Example capability
    }

    @DriverUrl
    URL url=new URL("http://95.216.217.133:4444/wd/hub/");


    @Test
    public void testWithCustomHeaders(WebDriver driver) {
        // Your test code here
        driver.get("https://www.example.com");
    }
}

ℹ️ Info: Important Notes:

  • Custom headers can only be added for tests that are executed using a remote driver. Ensure your setup accommodates remote driver configurations.
  • This feature is designed to enhance security and monitoring by allowing additional information to be included in HTTP requests.