casperjs presentation
DESCRIPTION
TRANSCRIPT
![Page 1: casperjs presentation](https://reader033.vdocuments.mx/reader033/viewer/2022051613/54c6846b4a7959ab1a8b4578/html5/thumbnails/1.jpg)
is a navigation scripting & testing utility for PhantomJS and SlimerJS written in Javascript
CasperJs.A Andriana K
![Page 2: casperjs presentation](https://reader033.vdocuments.mx/reader033/viewer/2022051613/54c6846b4a7959ab1a8b4578/html5/thumbnails/2.jpg)
Why using casperjs ?Scripting a browsing workflow using Javascript is painfully hard if you intend to use chained callbacks. This kind of code is a nightmare to write, to read, to understand and to maintain:
![Page 3: casperjs presentation](https://reader033.vdocuments.mx/reader033/viewer/2022051613/54c6846b4a7959ab1a8b4578/html5/thumbnails/3.jpg)
l Well, CasperJS solves this kind of problem using a convenient APIl for dealing with asynchronous stuff:
API docummentation
![Page 4: casperjs presentation](https://reader033.vdocuments.mx/reader033/viewer/2022051613/54c6846b4a7959ab1a8b4578/html5/thumbnails/4.jpg)
Simulate UI testing.
![Page 5: casperjs presentation](https://reader033.vdocuments.mx/reader033/viewer/2022051613/54c6846b4a7959ab1a8b4578/html5/thumbnails/5.jpg)
What is PhantomJS?
PhantomJS is a headless WebKit with a JavaScript API. It has fast and native support for various web standards: DOM handling, CSS selectors, JSON, Canvas and SVG.
![Page 6: casperjs presentation](https://reader033.vdocuments.mx/reader033/viewer/2022051613/54c6846b4a7959ab1a8b4578/html5/thumbnails/6.jpg)
Capturing screenshotsl Capturing a screenshot of a given area is as easy as this:
![Page 7: casperjs presentation](https://reader033.vdocuments.mx/reader033/viewer/2022051613/54c6846b4a7959ab1a8b4578/html5/thumbnails/7.jpg)
Creating navigation scenarios
l Want to simulate the user navigation as if he were clicking through links?l No problem:
![Page 8: casperjs presentation](https://reader033.vdocuments.mx/reader033/viewer/2022051613/54c6846b4a7959ab1a8b4578/html5/thumbnails/8.jpg)
Filling and handling forms
l Filling and submitting a form is not much harder:
![Page 9: casperjs presentation](https://reader033.vdocuments.mx/reader033/viewer/2022051613/54c6846b4a7959ab1a8b4578/html5/thumbnails/9.jpg)
Asynchronous rendering of page
l Sometimes (ok, often), lots of stuff is loaded asynchronously throughl Ajax or any other fancy invention of the Devil. You can just wait for it to happen:
![Page 10: casperjs presentation](https://reader033.vdocuments.mx/reader033/viewer/2022051613/54c6846b4a7959ab1a8b4578/html5/thumbnails/10.jpg)
Testingl Now all of this is fancy, but the true powers of CasperJS come from its functional testingl capabilities. For example, testing google search can be done that way :
![Page 11: casperjs presentation](https://reader033.vdocuments.mx/reader033/viewer/2022051613/54c6846b4a7959ab1a8b4578/html5/thumbnails/11.jpg)
Running the suite would produce this shiny colored output:
![Page 12: casperjs presentation](https://reader033.vdocuments.mx/reader033/viewer/2022051613/54c6846b4a7959ab1a8b4578/html5/thumbnails/12.jpg)
Implementation for digaku2l For all page
![Page 13: casperjs presentation](https://reader033.vdocuments.mx/reader033/viewer/2022051613/54c6846b4a7959ab1a8b4578/html5/thumbnails/13.jpg)
Output :
![Page 14: casperjs presentation](https://reader033.vdocuments.mx/reader033/viewer/2022051613/54c6846b4a7959ab1a8b4578/html5/thumbnails/14.jpg)
![Page 15: casperjs presentation](https://reader033.vdocuments.mx/reader033/viewer/2022051613/54c6846b4a7959ab1a8b4578/html5/thumbnails/15.jpg)
Problem in digaku2 UI testing
![Page 16: casperjs presentation](https://reader033.vdocuments.mx/reader033/viewer/2022051613/54c6846b4a7959ab1a8b4578/html5/thumbnails/16.jpg)
InferenceUsing casperjs more easy & powerfull than javascript, because casperjs directly call the API of the library
API docummentation
Installation
![Page 17: casperjs presentation](https://reader033.vdocuments.mx/reader033/viewer/2022051613/54c6846b4a7959ab1a8b4578/html5/thumbnails/17.jpg)
Thank you... :D