Mac
php語言寫入控制腳本
php腳本 => chromedriver => chromechrome
1:安裝<a href="http://www.php.cn/wiki/136.html" target="_blank">php-webdriver</a> 建立demo目錄,在目錄中執行
composer
<?php // An example of using php-webdriver. namespace Facebook\WebDriver; use Facebook\WebDriver\Remote\DesiredCapabilities; use Facebook\WebDriver\Remote\RemoteWebDriver; require_once('vendor/autoload.php'); //chromedriver默认端口 $host = 'http://localhost:9515'; $driver = RemoteWebDriver::create($host, DesiredCapabilities::chrome(), 50000); $driver->get('http://www.baidu.com'); $cookies = $driver->manage()->getCookies(); print_r($cookies); echo "The title is '" . $driver->getTitle() . "'\n"; echo "The current URI is '" . $driver->getCurrentURL() . "'\n"; //关闭浏览器 $driver->quit();
4:執行demo.php以上是PHP控制瀏覽器動作的詳細內容。更多資訊請關注PHP中文網其他相關文章!