Skip to content

Commit f49f3a1

Browse files
committed
Add support for execute args
1 parent 19e5890 commit f49f3a1

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

src/Driver/CoreDriver.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -428,15 +428,15 @@ public function dragTo($sourceXpath, $destinationXpath)
428428
/**
429429
* {@inheritdoc}
430430
*/
431-
public function executeScript($script)
431+
public function executeScript($script, $args = [])
432432
{
433433
throw new UnsupportedDriverActionException('JS is not supported by %s', $this);
434434
}
435435

436436
/**
437437
* {@inheritdoc}
438438
*/
439-
public function evaluateScript($script)
439+
public function evaluateScript($script, $args = [])
440440
{
441441
throw new UnsupportedDriverActionException('JS is not supported by %s', $this);
442442
}

src/Driver/DriverInterface.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -569,11 +569,12 @@ public function dragTo($sourceXpath, $destinationXpath);
569569
* Executes JS script.
570570
*
571571
* @param string $script
572+
* @param array $args
572573
*
573574
* @throws UnsupportedDriverActionException When operation not supported by the driver
574575
* @throws DriverException When the operation cannot be done
575576
*/
576-
public function executeScript($script);
577+
public function executeScript($script, $args = []);
577578

578579
/**
579580
* Evaluates JS script.
@@ -582,13 +583,14 @@ public function executeScript($script);
582583
* must accept the expression both with and without the keyword.
583584
*
584585
* @param string $script
586+
* @param array $args
585587
*
586588
* @return mixed
587589
*
588590
* @throws UnsupportedDriverActionException When operation not supported by the driver
589591
* @throws DriverException When the operation cannot be done
590592
*/
591-
public function evaluateScript($script);
593+
public function evaluateScript($script, $args = []);
592594

593595
/**
594596
* Waits some time or until JS condition turns true.

src/Session.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -325,22 +325,24 @@ public function switchToIFrame($name = null)
325325
* Execute JS in browser.
326326
*
327327
* @param string $script javascript
328+
* @param array $args
328329
*/
329-
public function executeScript($script)
330+
public function executeScript($script, $args = [])
330331
{
331-
$this->driver->executeScript($script);
332+
$this->driver->executeScript($script, $args);
332333
}
333334

334335
/**
335336
* Execute JS in browser and return its response.
336337
*
337338
* @param string $script javascript
339+
* @param array $args
338340
*
339341
* @return mixed
340342
*/
341-
public function evaluateScript($script)
343+
public function evaluateScript($script, $args = [])
342344
{
343-
return $this->driver->evaluateScript($script);
345+
return $this->driver->evaluateScript($script, $args);
344346
}
345347

346348
/**

0 commit comments

Comments
 (0)