以åãCentOSã«ææ°ã®PhantomJSãã¤ã³ã¹ãã¼ã«ãããã¨ããã¨ã¨ã©ã¼ãçºçããã¨ããè¨äºãæ¸ãã¾ãããshinsuke789.hatenablog.jp
ãã®å¾ãããã«èª¿ã¹ã¦ã¿ãã¨å¤ããã¼ã¸ã§ã³ã®ãã¤ããªãé
å¸ããã¦ãããã¨ããããããããã¤ã³ã¹ãã¼ã«ããã¨åé¡ãªã使ç¨ã§ããã®ã§ããã®æã®æé ãç´¹ä»ãã¾ãã
ç°å¢
OS | CentOS 6.4 |
---|---|
PhantomJS | 1.9.8 |
CasperJS | 1.1.0-beta3 |
æé
PhantomJS
1.PhantomJSã®Bitbucketãããã¤ããªãã¡ã¤ã«ããã¦ã³ãã¼ããã¾ãããã®ã¾ã¾wgetããã¨é·ãURLã«ãªã£ã¦ãã¾ãã®ã§ãå¥åã§ä¿åãã¾ãã
# ä¿åå ã«ç§»åãã cd /usr/local/src # ãã¤ããªããã¦ã³ãã¼ããã wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-1.9.8-linux-x86_64.tar.bz2 -O phantomjs-1.9.8-linux-x86_64.tar.bz2 # 解åãã tar jxvf phantomjs-1.9.8-linux-x86_64.tar.bz2 # 解åå¾ã®ãã£ã¬ã¯ããªåãå¤æ´ãã mv phantomjs-1.9.8-linux-x86_64 phantomjs # 移åãã cd phantomjs
2.ã/usr/local/binãã«ã·ã³ããªãã¯ãªã³ã¯ãä½æãã¾ãã
# phantomjsãã£ã¬ã¯ããªã§å®è¡ããï¼/usr/local/src/phantomjsï¼ ln -sf `pwd`/bin/phantomjs /usr/local/bin/phantomjs
3.ã¤ã³ã¹ãã¼ã«ãã¼ã¸ã§ã³ã確èªãã¾ãã
# ã/usr/local/src/phantomjs/binãã§å®è¡ãã phantomjs --version 1.9.8
ãã¹ã®è¨å®ã¯è¡ããããã®ã¾ã¾CasperJSã®ã¤ã³ã¹ãã¼ã«ãè¡ãã¾ãã
CasperJS
1.å ¬å¼ãµã¤ãã®ã¤ã³ã¹ãã¼ã«æé ï¼gitï¼ã«å¾ã£ã¦ã¤ã³ã¹ãã¼ã«ãè¡ãã¾ãã
# gitããªããã°ã¤ã³ã¹ãã¼ã«ãã yum install git # gitããåå¾ããï¼ä½æ¥ãã£ã¬ã¯ããªï¼/usr/local/srcï¼ git clone git://github.com/n1k0/casperjs.git # ãã£ã¬ã¯ããªã«ç§»åãã cd casperjs # ã/usr/local/binãã«ã·ã³ããªãã¯ãªã³ã¯ãä½æãã ln -sf `pwd`/bin/casperjs /usr/local/bin/casperjs
2.ã¤ã³ã¹ãã¼ã«ãã¼ã¸ã§ã³ã®ç¢ºèªãè¡ãã¾ãã
casperjs --version
1.1.0-beta3
ãã®æç¹ã§PhantomJSãCasperJSã¨ããã¹ãéã£ã¦ããã®ã§ã追å ã®è¨å®ã¯ä¸è¦ã§ãã
ãµã³ãã«ããã°ã©ã ã®å®è¡
1.Googleãµã¤ãã®ã¿ã¤ãã«ãåå¾ããç°¡åãªãµã³ãã«ããã°ã©ã ãtest.jsããviã¨ãã£ã¿çã§ä½æãã¾ãã
test.js
var casper = require('casper').create(); casper.start('http://www.google.co.jp/', function() { this.echo(this.getTitle()); }); casper.run();
2.ãµã³ãã«ããã°ã©ã ãå®è¡ãããGoogleãã¨åºåãããã°åä½ç¢ºèªå®äºã§ãã
casperjs test.js Google
PhantomJSæ²è¼ã®éèª
- ä½è : ä¸å·å樹,å±±å æ²ç,èå´å¥æ²»,åèç¥ä¸,ä»äºé太,å «æ¨æ©å¾¹å¹³,å®å·å¥å¤ª,è¿è¤å®æºæ,奥éå¹¹ä¹,天éç¥ä»,è³æã«ã¤,ä¼è¤ç´ä¹,ä½å·è£å²³,åå·è²´ä¹ ,è åä¸å¿,å¾è¤ç§å®£,ä¹ æ£®éé,ç»å°¾å¾³èª ,渡éæµå¤ª,ä¸å³¶è¡,A-Listers,å°ä¿£è£ä¸,ã¯ã¾ã¡ã2,å·æ·»è²´ç,ç³æ¬å å¸,èéç¥ä¸,æ²ç°é¦å¤«,澤ææ£æ¨¹,åé¨æå¹³,åè¤åè¨,çå±±æé,å¹³å±±æ¯ ,WEB+DB PRESSç·¨éé¨
- åºç社/ã¡ã¼ã«ã¼: æè¡è©è«ç¤¾
- çºå£²æ¥: 2013/10/24
- ã¡ãã£ã¢: 大åæ¬
- ãã®ååãå«ãããã° (3件) ãè¦ã
CasperJSæ²è¼ã®éèª
- ä½è : 鶴é·é®ä¸,å®®ä¸åè¼,縣ä¿è²´,ä¸æç¥æ,西尾泰å,æ°äºä¿ä¸,åå·æ¯ æ,ä¼è¤ç´ä¹,ç³å£æ²ä¸,æµ æ¨æ,渡éæµå¤ª,ä¸å³¶è¡,ã¯ã¾ã¡ã2,竹å,å·æ·»è²´ç,æ²³åå®æ,WEB+DB PRESSç·¨éé¨
- åºç社/ã¡ã¼ã«ã¼: æè¡è©è«ç¤¾
- çºå£²æ¥: 2014/04/24
- ã¡ãã£ã¢: 大åæ¬
- ãã®ååãå«ãããã° (6件) ãè¦ã