added docs for new capture*() imgOptions parameter
Showing
1 changed file
with
25 additions
and
2 deletions
... | @@ -496,7 +496,7 @@ Clicks on the first DOM element found containing ``label`` text. Optionaly ensur | ... | @@ -496,7 +496,7 @@ Clicks on the first DOM element found containing ``label`` text. Optionaly ensur |
496 | ``capture()`` | 496 | ``capture()`` |
497 | ------------------------------------------------------------------------------- | 497 | ------------------------------------------------------------------------------- |
498 | 498 | ||
499 | **Signature:** ``capture(String targetFilepath, Object clipRect)`` | 499 | **Signature:** ``capture(String targetFilepath, [Object clipRect, Object imgOptions])`` |
500 | 500 | ||
501 | Proxy method for PhantomJS' ``WebPage#render``. Adds a ``clipRect`` parameter for automatically setting page ``clipRect`` setting and reverts it back once done:: | 501 | Proxy method for PhantomJS' ``WebPage#render``. Adds a ``clipRect`` parameter for automatically setting page ``clipRect`` setting and reverts it back once done:: |
502 | 502 | ||
... | @@ -511,6 +511,22 @@ Proxy method for PhantomJS' ``WebPage#render``. Adds a ``clipRect`` parameter fo | ... | @@ -511,6 +511,22 @@ Proxy method for PhantomJS' ``WebPage#render``. Adds a ``clipRect`` parameter fo |
511 | 511 | ||
512 | casper.run(); | 512 | casper.run(); |
513 | 513 | ||
514 | .. versionadded:: 1.1 | ||
515 | |||
516 | The ``imgOptions`` object allows to specify two options: | ||
517 | |||
518 | - ``format`` to set the image format manually, avoiding relying on the filename | ||
519 | - ``quality`` to set the image quality, from 1 to 100 | ||
520 | |||
521 | Example:: | ||
522 | |||
523 | casper.start('http://foo', function() { | ||
524 | this.capture('foo', undefined, { | ||
525 | format: 'jpg', | ||
526 | quality: 75 | ||
527 | }); | ||
528 | }); | ||
529 | |||
514 | .. index:: screenshot, Base64 | 530 | .. index:: screenshot, Base64 |
515 | 531 | ||
516 | ``captureBase64()`` | 532 | ``captureBase64()`` |
... | @@ -555,7 +571,7 @@ Example:: | ... | @@ -555,7 +571,7 @@ Example:: |
555 | ``captureSelector()`` | 571 | ``captureSelector()`` |
556 | ------------------------------------------------------------------------------- | 572 | ------------------------------------------------------------------------------- |
557 | 573 | ||
558 | **Signature:** ``captureSelector(String targetFile, String selector)`` | 574 | **Signature:** ``captureSelector(String targetFile, String selector [, Object imgOptions])`` |
559 | 575 | ||
560 | Captures the page area containing the provided selector and saves it to ``targetFile``:: | 576 | Captures the page area containing the provided selector and saves it to ``targetFile``:: |
561 | 577 | ||
... | @@ -565,6 +581,13 @@ Captures the page area containing the provided selector and saves it to ``target | ... | @@ -565,6 +581,13 @@ Captures the page area containing the provided selector and saves it to ``target |
565 | 581 | ||
566 | casper.run(); | 582 | casper.run(); |
567 | 583 | ||
584 | .. versionadded:: 1.1 | ||
585 | |||
586 | The ``imgOptions`` object allows to specify two options: | ||
587 | |||
588 | - ``format`` to set the image format manually, avoiding relying on the target filename | ||
589 | - ``quality`` to set the image quality, from 1 to 100 | ||
590 | |||
568 | ``clear()`` | 591 | ``clear()`` |
569 | ------------------------------------------------------------------------------- | 592 | ------------------------------------------------------------------------------- |
570 | 593 | ... | ... |
-
Please register or sign in to post a comment