From f46dff599486a4ca1281cb52afaa768cede3de3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Vo=C5=99=C3=AD=C5=A1ek?= Date: Fri, 15 Apr 2022 12:18:13 +0200 Subject: [PATCH] Fix Session::{execute, execute_async}, must use value result --- lib/WebDriver/Session.php | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/lib/WebDriver/Session.php b/lib/WebDriver/Session.php index 497c10b..d4b3268 100644 --- a/lib/WebDriver/Session.php +++ b/lib/WebDriver/Session.php @@ -76,8 +76,6 @@ protected function methods() 'forward' => array('POST'), 'back' => array('POST'), 'refresh' => array('POST'), - 'execute' => array('POST'), - 'execute_async' => array('POST'), 'screenshot' => array('GET'), 'cookie' => array('GET', 'POST'), // for DELETE, use deleteAllCookies() 'source' => array('GET'), @@ -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']); $result = $this->curl('POST', '/execute', $jsonScript); - return $this->unserializeResult($result); + return $this->unserializeResult($result['value']); } /** @@ -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']); } /**