目次
seleniumを使ってPHPでChromeの自動操作
[blogcard url=”https://qiita.com/tsuuuuu_san/items/61379b797878d0e0f4d7″]
[blogcard url=”https://qiita.com/Rasukarusan/items/0ca204d5b0f0fb876252″]
[blogcard url=”https://qiita.com/yulily@github/items/c3edbe25e84280c17776″]
[blogcard url=”https://qiita.com/takepan/items/9170478b810d35ce4187″]
Selenium WebDriver
ブラウザ動かす機能
Selenium2とも呼ばれているようです。
facebook-webdriver
phpでSelenium動かすための機能
chromedriverのダウンロード
composerのダウンロード
[blogcard url=”https://getcomposer.org/doc/00-intro.md#installation-windows”]
[blogcard url=”https://haniwaman.com/windows-composer/”]
php webdriverインストール
composer require facebook/webdriver
java使えるようにする
[blogcard url=”https://java.com/ja/download/win10.jsp”]
[blogcard url=”https://qiita.com/ko2a/items/69fa8a5366d7449500ca”]
ポイント
java -jar selenium-server-standalone-3.4.0.jar &
webdriver メソッド
[blogcard url=”https://hacknote.jp/archives/44778″]
[blogcard url=”https://note.mu/743/n/n7367632b1e19″]
リンク
$driver->getElement(WebDriverBy::linkText(“リンク”))->click();
ID
$driver->getElement(WebDriverBy::id(“hoge”))->click();
Xpath
$driver->getElement(WebDriverBy::xpath(“//a[@href=’sample.html’]”))->click();
phantomjs
composer require “jonnyw/php-phantomjs:4.*”
・Apacheサーバ、PHPが動作する環境を設ける
・Javaのインストール
・Seleniumのダウンロード
・仮想デスクトップ(Xvfb)のインストール
・Chromiumのインストール
・Chromeドライバのダウンロード
・仮想デスクトップとSeleniumの起動
headlessなChromeをPHPで操作する
[blogcard url=”https://qiita.com/sarumonera/items/63a14f34e19f1cb96e87″]
[blogcard url=”http://www.ajisaba.net/develop/selenium/client_php_webdriver_chrome.html”]
Puppeteer
[blogcard url=”https://qiita.com/Quramy/items/26058e83e898ec2ec078″]
最終着地(centosにヘッドレスブラウザでやればうまくできそう)
[blogcard url=”http://www.ajisaba.net/develop/selenium/client_php_webdriver_chrome.html”]
[blogcard url=”https://blog.shimabox.net/2017/11/15/try_headless_chrome_and_firefox_with_php-webdriver/”]
Goutte
[blogcard url=”https://qiita.com/zaburo/items/45d748ae3966bf08323f”]
[blogcard url=”https://qiita.com/fksk/items/6807d5de07f93114087c”]
[blogcard url=”https://qiita.com/77web@github/items/3cd3b56985d5c6845661″]
php-phantomjs
[blogcard url=”https://qiita.com/passionate-engineer/items/de57cf2a7602b64ffed9″]
[blogcard url=”https://qiita.com/karashi39/items/c2346ef45d16c028010c”]
[blogcard url=”https://qiita.com/ttrun5706/items/538725a028a06a1a239d”]
composer require “jonnyw/php-phantomjs:4.*”
// PhantomJs require 'vendor/autoload.php'; use JonnyW\PhantomJs\Client; use JonnyW\PhantomJs\DependencyInjection\ServiceContainer; $client = Client::getInstance(); $client->getEngine()->setPath('vendor\bin\phantomjs.exe');