How do I pass Desired capabilities in Selenium 4 with PHPUnit?

How do I pass Desired capabilities in Selenium 4 with PHPUnit?

Hi Emma!

In order to pass Desired capabilities with PHPUnit in Selenium 4, you can refer to the below code snippet.

protected function driver()
    {

        $username = env('LT_USERNAME');
        $access_key = env('LT_ACCESS_KEY');
        $url = "https://".$username.":".$access_key."@hub.lambdatest.com/wd/hub";

        $capability = array(
        "browserName" => "Chrome",
        "browserVersion" => "104.0",
        "LT:Options" => array(
                "username" => "LT_USERNAME",
                "accessKey" => "LT_ACCESS_KEY",
                "platformName" => "Windows 10",
                "project" => "Untitled",
                "selenium_version" => "4.0.0",
                "w3c" => true,
                "plugin" => "php-php_unit"
        )
);
     );

        return RemoteWebDriver::create($url,$capabilities);
    }

}

For more details, please check our documentation.