Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 4 additions & 10 deletions lib/WebDriver/Session.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,6 @@ protected function methods()
'forward' => array('POST'),
'back' => array('POST'),
'refresh' => array('POST'),
'execute' => array('POST'),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pure cleanup as explicitly defined methods seems to be not defined in this list

'execute_async' => array('POST'),
'screenshot' => array('GET'),
'cookie' => array('GET', 'POST'), // for DELETE, use deleteAllCookies()
'source' => array('GET'),
Expand Down Expand Up @@ -433,13 +431,11 @@ public function log()
*/
public function execute(array $jsonScript)
{
if (isset($jsonScript['args'])) {
$jsonScript['args'] = $this->serializeArguments($jsonScript['args']);
}
$jsonScript['args'] = $this->serializeArguments($jsonScript['args']);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pure cleanup, args are always required, otherwise Selenium throws:

  WebDriver\Exception\UnknownError: invalid argument: 'args' must be a list
        (Session info: headless chrome=84.0.4147.105)
      Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
      System info: host: 'xxx', ip: 'xxx', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '12.0.2'
      Driver info: driver.version: unknown in C:\...\vendor\instaclick\php-webdriver\lib\WebDriver\Exception.php:156
      Stack trace:
      #0 C:\...\vendor\instaclick\php-webdriver\lib\WebDriver\AbstractWebDriver.php(170): WebDriver\Exception::factory()
      #1 C:\...\vendor\instaclick\php-webdriver\lib\WebDriver\AbstractWebDriver.php(243): WebDriver\AbstractWebDriver->curl()
      #2 C:\...\vendor\instaclick\php-webdriver\lib\WebDriver\Container.php(241): WebDriver\AbstractWebDriver->__call()
      #3 C:\...\vendor\instaclick\php-webdriver\lib\WebDriver\Session.php(440): WebDriver\Container->__call()
      #4 src\Behat\Context.php(297): WebDriver\Session->execute()


$result = $this->curl('POST', '/execute', $jsonScript);

return $this->unserializeResult($result);
return $this->unserializeResult($result['value']);
}

/**
Expand All @@ -451,13 +447,11 @@ public function execute(array $jsonScript)
*/
public function execute_async(array $jsonScript)
{
if (isset($jsonScript['args'])) {
$jsonScript['args'] = $this->serializeArguments($jsonScript['args']);
}
$jsonScript['args'] = $this->serializeArguments($jsonScript['args']);

$result = $this->curl('POST', '/execute_async', $jsonScript);

return $this->unserializeResult($result);
return $this->unserializeResult($result['value']);
}

/**
Expand Down