Open
Description
Problem 1 - incorrectly built $parameters array
Calling the \WebDriver\WebDriver::session
is always attempting to create a non-W3C compatible session for Selenium 3/4.
An exception, that is thrown upon a W3C session creation attempt (which is immediately caught) looks like this:
Expected to read a START_COLLECTION but instead have: START_MAP. Last 30 characters read: {"capabilities":{"firstMatch":, next 128 characters to read: {"browserName":"chrome","name":"Behat Test","goog:chromeOptions":{"binary":"\/path\/to\/custom\/browser-binary
Build info: version: '4.17.0', revision: 'e52b1be057*'
Driver info: driver.version: unknown
The \WebDriver\WebDriver::session
method arguments:
- $browserName:
chrome
- $desiredCapabilities:
array (
'browserName' => 'chrome',
'name' => 'Behat Test',
'goog:chromeOptions' => array (
'binary' => '/path/to/custom/browser-binary,
),
)
- $requiredCapabilities:
null
Solution
Replace
// default to W3C WebDriver API
$firstMatch = $desiredCapabilities ?: array();
$firstMatch[] = array('browserName' => Browser::CHROME);
with
$firstMatch = $desiredCapabilities ? array($desiredCapabilities) : array();
$firstMatch[] = array('browserName' => Browser::CHROME);
Done in #135.
Problem 2 - the non-W3C capabilities aren't converted to W3C capabilities
After fixing the above problem the exception message is now different:
Illegal key values seen in w3c capabilities: [name]
Solution
Covert desired/required capabilities array using an approach similar to https://github.com/php-webdriver/php-webdriver/blob/5d8e66ff849b5614015d35e99d759252e371ce26/lib/Remote/DesiredCapabilities.php#L206-L265 .
Metadata
Metadata
Assignees
Labels
No labels