### JS调用
* * * * *
~~~
<?php
namespace Facebook\WebDriver;
use Facebook\WebDriver\Remote\DesiredCapabilities;
use Facebook\WebDriver\Remote\RemoteWebDriver;
require_once('vendor/autoload.php');
header("Content-Type: text/html; charset=UTF-8");
// start Firefox with 5 second timeout
$host = 'http://localhost:4444/wd/hub'; // this is the default
$capabilities = DesiredCapabilities::chrome();
$driver = RemoteWebDriver::create($host, $capabilities, 5000);
$driver->get('https://www.baidu.com/');
$element = $driver->findElement(WebDriverBy::className('s_ipt'));
$js = <<<js
document.getElementById("kw").style.border = '2px solid red';
var button = document.getElementById("su");
button.setAttribute('type','button');
button.setAttribute('onclick','document.getElementById("kw").style.border = "2px solid blue";alert("hello,dear wangkun!");');
js;
$driver->executeScript($js);
echo 'done!';
//关闭浏览器
//$driver->quit();
?>
~~~