Deleted articles cannot be recovered. Draft of this article would be also deleted. Are you sure you want to delete this article?
Chrome59(2017/05/27現在はベータ)から--headlessオプションを使うことでChromeをヘッドレスブラウザとして使えます。これをNodeJSから操作するにはchrome-remote-interfaceというNPMパッケージを使うのですが、そのままですとなかなか面倒です。そこで、NightmareJS風にヘッドレスChromeを操作することができるライブラリをご紹介します。 GitHub: https://github.com/OnetapInc/chromy 基本的な使い方 このようにNightmareJS風のメソッドチェーンで操作することができます。visibleオプションを指定すればヘッドレスモードではなく通常モードでChromeを起動することもできます。 Chrome本体は標準的なインストールをしていれば自動的に最も新しいChromeを探してそれを起動します
あなたにとって重要なトピックや同僚の最新情報を入手しましょう最新の洞察とトレンドに関する最新情報を即座に受け取りましょう。 継続的な学習のために、無料のリソースに手軽にアクセスしましょうミニブック、トランスクリプト付き動画、およびトレーニング教材。 記事を保存して、いつでも読むことができます記事をブックマークして、準備ができたらいつでも読めます。
#はじめに 前回のエントリー「phantomjs/casperjsによるキャプチャー自動化」で簡単なキャプチャースクリプトを製作しましたがサイトによって背景色が黒くなってしまったりと、課題や改修すべきところがありましたので前回のスクリプトをベースに改修していきたいと思います。 (環境構築は既に済んでいる前提です。) #課題、改修点 ・サイトによっては背景が黒くなってしまう >jqueryを読み込んで背景色を書き換えます。 ・キャプチャーするファイルリストを外部ファイル化(csvファイル読み込みも) >jsonファイルの外部化だけだと簡単すぎるので、csvファイル読み込みのパターンも実装したいと思います。エクセルからキャプチャーリストを作成したり、website explorerからURLだけ引っ張ってきて連続キャプチャーしたりと使い勝手がよくなります。 ・キャプチャーした画像の保存先を変更
はじめに とあるサイトに定期的にログインして利用履歴のCSVを取ってくるというプログラムを AppleScript + Safariで書いていたがいちいち Safari が起動してめんどくさいので、PhantomJS で書きなおすことにした。 さっそく PhantomJS の最新版(1.9.2) をインストールして、スクリプトを書いた。コードは下記のとおりである(簡易化してある)。 page = (require 'webpage').create() callbacks = [ -> # ログイン画面の処理 page.evaluate -> document.getElementById('user').value = 'user' document.getElementById('pass').value = 'pass' e = document.createEvent('Mouse
PhantomJSとは HP: PhantomJS 参考までに: GoogleとAppleが争う「WebKit」ってどうして重要? 一言で言うと、WebkitベースのHeadlessブラウザ。Webkitとは主にWebブラウザーで用いられているレンダリングエンジンのこと。PhantomJSはwebkitにbuilt-inされているJavaScriptCore (safariとかもこれを使っている) というjavascriptエンジンを採用している。スクレイピングやスクリーンキャプチャなどにも活用可能。 PhantomJSに出会うまでの経緯 Python3.4でスクレイピングを試していたらJavaScriptのレンダリングがかかっているサイトにぶつかった。PythonでさくっとWebスクレイピングする (JavaScript読み込みにも対応しつつ)というサイトを参考に辿って行くことに。。 I
Because PhantomJS permits the inspection of network traffic, it is suitable to build various analysis on the network behavior and performance. All the resource requests and responses can be sniffed using onResourceRequested and onResourceReceived. A very simple example to log every request and response is illustrated in the script netlog.js: var page = require('webpage').create(); page.onResourceR
1 pixel|サイバーエージェント公式クリエイターズブログ サイバーエージェントのクリエイターの取り組みを紹介するオフィシャルブログです。最新技術への挑戦やサービス誕生の裏話、勉強会やイベントのレポートなどCAクリエイターの情報が満載です。 みなさんこんにちは! スマホ版Ameba担当の川口です。 ちょうど一年前、同じようにJavaScriptを使ったテスト手法について記事を書かせていただいたのですが、今回も懲りずにまた同じようなテーマで再登場いたしました。 JavaScriptのテスト手法 さて、スマホ版Amebaの全面リニューアルから早くも1年経ったのですが、今回はそんなスマホ版Amebaで日々自動テストツールとして活躍してもらっているPhantomJSを紹介させていただきます。 長い記事になるため、今回は前編・後編に分けて以下のような構成でお送りいたします。 ●前編 ・Phanto
This page contains information about what to do if PhantomJS crashes. You will have seen a message like this: PhantomJS has crashed. Please file a bug report at https://github.com/ariya/phantomjs/issues/new and attach the crash dump file: /tmp/598e080c-58dd-e183-12fb7ba8-29a93fff.dmp” If you’re using an official binary (downloaded or installed via Homebrew) You can post the crash dump to an issue,
Webページの表示速度って大事ですよね。Googleの検索順位にも影響が出るっていうし、なによりユーザが見たいと思った時に、遅くてなかなか見られないというのは単純に機会損失になります。じゃあ表示速度を早くしようとなるわけですが、そこらへんはわりとベストプラクティスみたいなのが語られまくってますね。 ちょっと古いですが僕が昔か書いたWebフロントエンド表示速度、最速化手法まとめみたいなのとか。 で、早くする技工的なものは良いんですが、一番大事なのは計測すること。これですね。普段、どれくらいの表示速度で、揺らぎがあるのかないのか、どこかの時点で遅くなっていないかなどを把握する必要があります。 サイト表示速度の監視 サイトの表示速度を計測してくれるナイスなサービスがいくつかあります。 pingdom newrelic ruxit HAPPY APPS ALERT BOT Status Cake
Latest Version Before reporting an issue, make sure you are using the latest version: All examples are designed to work with the latest version of PhantomJS. If some examples do not work, make sure that there is not more than one version of PhantomJS installed in the system. Multiple versions may lead to conflict as to which one is being invoked in the terminal. Network Problem If the data is not
Since PhantomJS is using WebKit, a real layout and rendering engine, it can capture a web page as a screenshot. Because PhantomJS can render anything on the web page, it can be used to convert HTML content styled with CSS but also SVG, images and Canvas elements. The following script demonstrates the simplest use of page capture. It loads the GitHub homepage and then saves it as an image, github.p
Because PhantomJS can load and manipulate a web page, it is perfect to carry out various page automation tasks. DOM Manipulation Since the script is executed as if it is running on a web browser, standard DOM scripting and CSS selectors work just fine. The following useragent.js example demonstrates reading the textContent property of the element whose id is qua: var page = require('webpage').crea
PhantomJS 2.1 was released on January 23, 2016. It came with an updated WebKit library based on Qt 5.5. New features Upgraded Qt to 5.5.1 (issue #13377) Added support for SSL Client Authentication (issue #11275) Added support for context menu event (issue #11429) Allow remote debugging to use random port assigned by the OS (issue #13432) Improvements Allow outer context to access arbitrary URLs (i
C:\Users\**>npm install nightmare | > weak@0.3.3 install C:\Users\**\node_modules\nightmare\node_modules\phantom\node_modules\dnode\node_modules\weak > node-gyp rebuild C:\Users\**\node_modules\nightmare\node_modules\phantom\node_modules\dnode\node_modules\weak>node "C:\Program Fil es\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild Building the projec
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く