我爱编程

casperjs+phantomjs下的

2017-08-07  本文已影响27人  dittoyy3991

npm install -g casperjs
只需这一句就好了

casperjs

npm install --save 与 npm install --save-dev 的区别
一个放在package.json 的dependencies , 一个放在devDependencies里面

casper官方文档
caspersamplegit

代码我先上传到mygithub吧,下次再继续研究你

cmd下输出的

D:\qq\969956574\FileRecv\8\8\js>casperjs test cas2.js
Test file: cas2.js
# Hello, Test!
PASS Subject is strictly true
PASS Hello, Test! (1 test)
PASS 1 test executed in 0.022s, 1 passed, 0 failed, 0 dubious, 0 skipped.
D:\qq\969956574\FileRecv\8\8\js>casperjs cas3.js
http://docs.casperjs.org/en/latest/quickstart.html
http://docs.casperjs.org/en/latest/
https://github.com/casperjs/casperjs
https://groups.google.com/forum/#!forum/casperjs
TypeError: 'undefined' is not a function (evaluating 'casper.done()')
  D:/qq/969956574/FileRecv/8/8/js/cas3.js:23
  D:/qq/969956574/FileRecv/8/8/js/node_modules/casperjs/modules/casper.js:422 in
 checkStep

D:\qq\969956574\FileRecv\8\8\js>casperjs cas3.js
http://docs.casperjs.org/en/latest/quickstart.html
http://docs.casperjs.org/en/latest/
https://github.com/casperjs/casperjs
https://groups.google.com/forum/#!forum/casperjs
TypeError: 'undefined' is not a function (evaluating 'casper.done()')
  D:/qq/969956574/FileRecv/8/8/js/cas3.js:23
  D:/qq/969956574/FileRecv/8/8/js/node_modules/casperjs/modules/casper.js:422 in
 checkStep

D:\qq\969956574\FileRecv\8\8\js>casperjs cas3.js
SyntaxError: Parse error


D:\qq\969956574\FileRecv\8\8\js>casperjs cas_go.js
Wait timeout of 5000ms expired, exiting.

D:\qq\969956574\FileRecv\8\8\js>casperjs cas4.js --foo=01234567
1234567

D:\qq\969956574\FileRecv\8\8\js>casperjs casc1.js
the heading exists

D:\qq\969956574\FileRecv\8\8\js>casperjs test casc1.js
Test file: casc1.js
# The heading exists
PASS Find an element matching: h1.page-title
PASS The heading exists (1 test)
PASS 1 test executed in 0.097s, 1 passed, 0 failed, 0 dubious, 0 skipped.

D:\qq\969956574\FileRecv\8\8\js>casperjs test casc1.js
Test file: casc1.js
# Page content tests
PASS Find an element matching: h1.page-title
PASS Find "Hello" within the selector "h1.page-title"
PASS Selector is visible
PASS Page content tests (3 tests)
PASS 3 tests executed in 0.101s, 3 passed, 0 failed, 0 dubious, 0 skipped.

D:\qq\969956574\FileRecv\8\8\js>
上一篇下一篇

猜你喜欢

热点阅读