1<?php 2 3namespace Facebook\WebDriver; 4 5/** 6 * WebDriver interface implemented by drivers that support JavaScript. 7 */ 8interface JavaScriptExecutor 9{ 10 /** 11 * Inject a snippet of JavaScript into the page for execution in the context 12 * of the currently selected frame. The executed script is assumed to be 13 * synchronous and the result of evaluating the script will be returned. 14 * 15 * @param string $script The script to inject. 16 * @param array $arguments The arguments of the script. 17 * @return mixed The return value of the script. 18 */ 19 public function executeScript($script, array $arguments = []); 20 21 /** 22 * Inject a snippet of JavaScript into the page for asynchronous execution in 23 * the context of the currently selected frame. 24 * 25 * The driver will pass a callback as the last argument to the snippet, and 26 * block until the callback is invoked. 27 * 28 * @see WebDriverExecuteAsyncScriptTestCase 29 * 30 * @param string $script The script to inject. 31 * @param array $arguments The arguments of the script. 32 * @return mixed The value passed by the script to the callback. 33 */ 34 public function executeAsyncScript($script, array $arguments = []); 35} 36