diff --git a/src/Driver/CoreDriver.php b/src/Driver/CoreDriver.php index 9b4c04e43..9e01f6ff4 100644 --- a/src/Driver/CoreDriver.php +++ b/src/Driver/CoreDriver.php @@ -428,7 +428,7 @@ public function dragTo($sourceXpath, $destinationXpath) /** * {@inheritdoc} */ - public function executeScript($script) + public function executeScript($script, array $args = []) { throw new UnsupportedDriverActionException('JS is not supported by %s', $this); } @@ -436,7 +436,7 @@ public function executeScript($script) /** * {@inheritdoc} */ - public function evaluateScript($script) + public function evaluateScript($script, array $args = []) { throw new UnsupportedDriverActionException('JS is not supported by %s', $this); } @@ -444,7 +444,7 @@ public function evaluateScript($script) /** * {@inheritdoc} */ - public function wait($timeout, $condition) + public function wait($timeout, $condition, array $args = []) { throw new UnsupportedDriverActionException('JS is not supported by %s', $this); } diff --git a/src/Driver/DriverInterface.php b/src/Driver/DriverInterface.php index 0eec66bc5..f344dd486 100644 --- a/src/Driver/DriverInterface.php +++ b/src/Driver/DriverInterface.php @@ -569,11 +569,12 @@ public function dragTo($sourceXpath, $destinationXpath); * Executes JS script. * * @param string $script + * @param array $args * * @throws UnsupportedDriverActionException When operation not supported by the driver * @throws DriverException When the operation cannot be done */ - public function executeScript($script); + public function executeScript($script, array $args = []); /** * Evaluates JS script. @@ -582,26 +583,28 @@ public function executeScript($script); * must accept the expression both with and without the keyword. * * @param string $script + * @param array $args * * @return mixed * * @throws UnsupportedDriverActionException When operation not supported by the driver * @throws DriverException When the operation cannot be done */ - public function evaluateScript($script); + public function evaluateScript($script, array $args = []); /** * Waits some time or until JS condition turns true. * * @param int $timeout timeout in milliseconds * @param string $condition JS condition + * @param array $args * * @return bool * * @throws UnsupportedDriverActionException When operation not supported by the driver * @throws DriverException When the operation cannot be done */ - public function wait($timeout, $condition); + public function wait($timeout, $condition, array $args = []); /** * Set the dimensions of the window. diff --git a/src/Session.php b/src/Session.php index 2bb16b640..c1db02fc7 100644 --- a/src/Session.php +++ b/src/Session.php @@ -325,22 +325,24 @@ public function switchToIFrame($name = null) * Execute JS in browser. * * @param string $script javascript + * @param array $args */ - public function executeScript($script) + public function executeScript($script, array $args = []) { - $this->driver->executeScript($script); + $this->driver->executeScript($script, $args); } /** * Execute JS in browser and return its response. * * @param string $script javascript + * @param array $args * * @return mixed */ - public function evaluateScript($script) + public function evaluateScript($script, array $args = []) { - return $this->driver->evaluateScript($script); + return $this->driver->evaluateScript($script, $args); } /** @@ -348,12 +350,13 @@ public function evaluateScript($script) * * @param int $time time in milliseconds * @param string $condition JS condition + * @param array $args * * @return bool */ - public function wait($time, $condition = 'false') + public function wait($time, $condition = 'false', array $args = []) { - return $this->driver->wait($time, $condition); + return $this->driver->wait($time, $condition, $args); } /**