Skip to content

Commit b37c535

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

3 files changed

Lines changed: 18 additions & 12 deletions

File tree

src/Driver/CoreDriver.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -428,23 +428,23 @@ public function dragTo($sourceXpath, $destinationXpath)
428428
/**
429429
* {@inheritdoc}
430430
*/
431-
public function executeScript($script)
431+
public function executeScript($script, array $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, array $args = [])
440440
{
441441
throw new UnsupportedDriverActionException('JS is not supported by %s', $this);
442442
}
443443

444444
/**
445445
* {@inheritdoc}
446446
*/
447-
public function wait($timeout, $condition)
447+
public function wait($timeout, $condition, array $args = [])
448448
{
449449
throw new UnsupportedDriverActionException('JS is not supported by %s', $this);
450450
}

src/Driver/DriverInterface.php

Lines changed: 6 additions & 3 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, array $args = []);
577578

578579
/**
579580
* Evaluates JS script.
@@ -582,26 +583,28 @@ 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, array $args = []);
592594

593595
/**
594596
* Waits some time or until JS condition turns true.
595597
*
596598
* @param int $timeout timeout in milliseconds
597599
* @param string $condition JS condition
600+
* @param array $args
598601
*
599602
* @return bool
600603
*
601604
* @throws UnsupportedDriverActionException When operation not supported by the driver
602605
* @throws DriverException When the operation cannot be done
603606
*/
604-
public function wait($timeout, $condition);
607+
public function wait($timeout, $condition, array $args = []);
605608

606609
/**
607610
* Set the dimensions of the window.

src/Session.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -325,35 +325,38 @@ 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, array $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, array $args = [])
342344
{
343-
return $this->driver->evaluateScript($script);
345+
return $this->driver->evaluateScript($script, $args);
344346
}
345347

346348
/**
347349
* Waits some time or until JS condition turns true.
348350
*
349351
* @param int $time time in milliseconds
350352
* @param string $condition JS condition
353+
* @param array $args
351354
*
352355
* @return bool
353356
*/
354-
public function wait($time, $condition = 'false')
357+
public function wait($time, $condition = 'false', array $args = [])
355358
{
356-
return $this->driver->wait($time, $condition);
359+
return $this->driver->wait($time, $condition, $args);
357360
}
358361

359362
/**

0 commit comments

Comments
 (0)