Hey Tominek,
thank you for your answer. Sadly this it not what I'm looking for.
I wan to change the desired capabilities before a scenario is executed, so I can not use the behat.yml. However, I found a way to do this, even so it is kind of a hack:
First I created my own mink class
class MyMink extends Mink
{
}
Then I overwrite the getSession-Method so I can adjust the desired capabilities for my needs:
public function getSession($name = null)
{
$session = $this->locateSession($name);
$driver = $session->getDriver();
if ($driver instanceof Selenium2Driver && !$session->isStarted()) {
$this->prepareDesiredCapabilities($driver);
}
// start session if needed
if (!$session->isStarted()) {
$session->start();
}
return $session;
}
The prepareDesiredCapabilities-Method adjust the capabilites for my needs, but first I had to find a way to get the current desired capabilites from the Selenium2Driver, since there is no getter and the instance variable is private
And finally I could append my own desired capabilites to the driver
/**
* @param Selenium2Driver $driver
*/
private function prepareDesiredCapabilities(Selenium2Driver $driver)
{
$desiredCapabilities = $this->getDesiredCapabilities($driver);
$desiredCapabilities['build'] = $this->getBuildName();
$driver->setDesiredCapabilities($desiredCapabilities);
}
To get behat to use the newly created mink class, I had to write my own extension which (again) extends the main mink extension class:
class MyMinkExtension extends MinkExtension
{
}
And in the end I use this Extension instead of the main MinkExtension in my behat.yml
default:
extensions:
MyMinkExtension:
base_url: https://www.example.com
sessions:
default:
# ...
I know this way is not perfekt, but it was the only way I found. I hope this might help someone else
Kind Regards