ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
### 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(); ?> ~~~