@@ -26,21 +26,21 @@ public class Shutterbug {
2626 * @return PageSnapshot instance
2727 */
2828 public static PageSnapshot shootPage (WebDriver driver ) {
29- return shootPage (driver ,false );
29+ return shootPage (driver , true );
3030 }
3131
3232 /**
3333 * Make screen shot of the viewport only.
3434 * To be used when screen shooting the page
3535 * and don't need to scroll while making screen shots (FF, IE).
3636 *
37- * @param driver WebDriver instance
37+ * @param driver WebDriver instance
3838 * @param useDevicePixelRatio whether or not take into account device pixel ratio
3939 * @return PageSnapshot instance
4040 */
4141 public static PageSnapshot shootPage (WebDriver driver , boolean useDevicePixelRatio ) {
4242 Browser browser = new Browser (driver , useDevicePixelRatio );
43- PageSnapshot pageScreenshot = new PageSnapshot (driver ,browser .getDevicePixelRatio ());
43+ PageSnapshot pageScreenshot = new PageSnapshot (driver , browser .getDevicePixelRatio ());
4444 pageScreenshot .setImage (browser .takeScreenshot ());
4545 return pageScreenshot ;
4646 }
@@ -63,84 +63,84 @@ public static PageSnapshot shootPage(WebDriver driver, ScrollStrategy scroll) {
6363 * and need to scroll while making screen shots, either vertically or
6464 * horizontally or both directions (Chrome).
6565 *
66- * @param driver WebDriver instance
67- * @param scroll ScrollStrategy How you need to scroll
68- * @param betweenScrollTimeout Timeout to wait after scrolling and before taking screenshot
66+ * @param driver WebDriver instance
67+ * @param scroll ScrollStrategy How you need to scroll
68+ * @param betweenScrollTimeout Timeout to wait after scrolling and before taking screenshot
6969 * @return PageSnapshot instance
7070 */
7171 public static PageSnapshot shootPage (WebDriver driver , ScrollStrategy scroll , int betweenScrollTimeout ) {
72- return shootPage (driver ,scroll ,betweenScrollTimeout ,false );
72+ return shootPage (driver , scroll , betweenScrollTimeout , true );
7373 }
7474
7575 /**
7676 * To be used when screen shooting the page
7777 * and need to scroll while making screen shots, either vertically or
7878 * horizontally or both directions (Chrome).
7979 *
80- * @param driver WebDriver instance
81- * @param scroll ScrollStrategy How you need to scroll
82- * @param betweenScrollTimeout Timeout to wait after scrolling and before taking screenshot
83- * @param afterScrollTimeout Timeout to wait after scrolling and before taking screenshot
80+ * @param driver WebDriver instance
81+ * @param scroll ScrollStrategy How you need to scroll
82+ * @param betweenScrollTimeout Timeout to wait after scrolling and before taking screenshot
83+ * @param afterScrollTimeout Timeout to wait after scrolling and before taking screenshot
8484 * @return PageSnapshot instance
8585 */
8686 public static PageSnapshot shootPage (WebDriver driver , ScrollStrategy scroll , int betweenScrollTimeout , int afterScrollTimeout ) {
87- return shootPage (driver ,scroll ,betweenScrollTimeout ,false , afterScrollTimeout );
87+ return shootPage (driver , scroll , betweenScrollTimeout , true , afterScrollTimeout );
8888 }
8989
9090 /**
9191 * To be used when screen shooting the page
9292 * and need to scroll while making screen shots, either vertically or
9393 * horizontally or both directions (Chrome).
9494 *
95- * @param driver WebDriver instance
96- * @param scroll ScrollStrategy How you need to scroll
97- * @param useDevicePixelRatio whether or not take into account device pixel ratio
95+ * @param driver WebDriver instance
96+ * @param scroll ScrollStrategy How you need to scroll
97+ * @param useDevicePixelRatio whether or not take into account device pixel ratio
9898 * @return PageSnapshot instance
9999 */
100100 public static PageSnapshot shootPage (WebDriver driver , ScrollStrategy scroll , boolean useDevicePixelRatio ) {
101- return shootPage (driver ,scroll ,0 , useDevicePixelRatio );
101+ return shootPage (driver , scroll , 0 , useDevicePixelRatio );
102102 }
103103
104104 /**
105105 * To be used when screen shooting the page
106106 * and need to scroll while making screen shots, either vertically or
107107 * horizontally or both directions (Chrome).
108108 *
109- * @param driver WebDriver instance
110- * @param scroll ScrollStrategy How you need to scroll
111- * @param useDevicePixelRatio whether or not take into account device pixel ratio
112- * @param afterScrollTimeout Timeout to wait after scrolling and before taking screenshot
109+ * @param driver WebDriver instance
110+ * @param scroll ScrollStrategy How you need to scroll
111+ * @param useDevicePixelRatio whether or not take into account device pixel ratio
112+ * @param afterScrollTimeout Timeout to wait after scrolling and before taking screenshot
113113 * @return PageSnapshot instance
114114 */
115115 public static PageSnapshot shootPage (WebDriver driver , ScrollStrategy scroll , boolean useDevicePixelRatio , int afterScrollTimeout ) {
116- return shootPage (driver ,scroll ,0 , useDevicePixelRatio , afterScrollTimeout );
116+ return shootPage (driver , scroll , 0 , useDevicePixelRatio , afterScrollTimeout );
117117 }
118118
119119 /**
120120 * To be used when screen shooting the page
121121 * and need to scroll while making screen shots, either vertically or
122122 * horizontally or both directions (Chrome).
123123 *
124- * @param driver WebDriver instance
125- * @param scroll ScrollStrategy How you need to scroll
126- * @param betweenScrollTimeout Timeout to wait between each scrolling operation
127- * @param useDevicePixelRatio whether or not take into account device pixel ratio
124+ * @param driver WebDriver instance
125+ * @param scroll ScrollStrategy How you need to scroll
126+ * @param betweenScrollTimeout Timeout to wait between each scrolling operation
127+ * @param useDevicePixelRatio whether or not take into account device pixel ratio
128128 * @return PageSnapshot instance
129129 */
130130 public static PageSnapshot shootPage (WebDriver driver , ScrollStrategy scroll , int betweenScrollTimeout , boolean useDevicePixelRatio ) {
131- return shootPage (driver ,scroll ,betweenScrollTimeout ,useDevicePixelRatio ,0 );
131+ return shootPage (driver , scroll , betweenScrollTimeout , useDevicePixelRatio , 0 );
132132 }
133133
134134 /**
135135 * To be used when screen shooting the page
136136 * and need to scroll while making screen shots, either vertically or
137137 * horizontally or both directions (Chrome).
138138 *
139- * @param driver WebDriver instance
140- * @param scroll ScrollStrategy How you need to scroll
141- * @param betweenScrollTimeout Timeout to wait between each scrolling operation
142- * @param afterScrollTimeout Timeout to wait after scrolling and before taking screenshot
143- * @param useDevicePixelRatio whether or not take into account device pixel ratio
139+ * @param driver WebDriver instance
140+ * @param scroll ScrollStrategy How you need to scroll
141+ * @param betweenScrollTimeout Timeout to wait between each scrolling operation
142+ * @param afterScrollTimeout Timeout to wait after scrolling and before taking screenshot
143+ * @param useDevicePixelRatio whether or not take into account device pixel ratio
144144 * @return PageSnapshot instance
145145 */
146146 public static PageSnapshot shootPage (WebDriver driver , ScrollStrategy scroll , int betweenScrollTimeout , boolean useDevicePixelRatio , int afterScrollTimeout ) {
@@ -168,9 +168,9 @@ public static PageSnapshot shootPage(WebDriver driver, ScrollStrategy scroll, in
168168 * @return ElementSnapshot instance
169169 */
170170 public static ElementSnapshot shootElementVerticallyCentered (WebDriver driver , WebElement element ) {
171- return shootElementVerticallyCentered (driver ,element ,false );
171+ return shootElementVerticallyCentered (driver , element , true );
172172 }
173-
173+
174174 /**
175175 * To be used when need to screenshot particular element.
176176 *
@@ -179,39 +179,38 @@ public static ElementSnapshot shootElementVerticallyCentered(WebDriver driver, W
179179 * @return ElementSnapshot instance
180180 */
181181 public static ElementSnapshot shootElement (WebDriver driver , WebElement element ) {
182- return shootElement (driver ,element ,false );
182+ return shootElement (driver , element , true );
183183 }
184184
185185 /**
186186 * To be used when need to screenshot particular element.
187187 *
188- * @param driver WebDriver instance
189- * @param element WebElement instance to be screen shot
188+ * @param driver WebDriver instance
189+ * @param element WebElement instance to be screen shot
190190 * @param useDevicePixelRatio whether or not take into account device pixel ratio
191191 * @return ElementSnapshot instance
192192 */
193193 public static ElementSnapshot shootElement (WebDriver driver , WebElement element , boolean useDevicePixelRatio ) {
194194 Browser browser = new Browser (driver , useDevicePixelRatio );
195195 ElementSnapshot elementSnapshot = new ElementSnapshot (driver , browser .getDevicePixelRatio ());
196196 browser .scrollToElement (element );
197- elementSnapshot .setImage (browser .takeScreenshot (),browser .getBoundingClientRect (element ));
197+ elementSnapshot .setImage (browser .takeScreenshot (), browser .getBoundingClientRect (element ));
198198 return elementSnapshot ;
199199 }
200-
200+
201201 /**
202202 * To be used when need to screenshot particular element by vertically centering it within viewport.
203203 *
204- * @param driver WebDriver instance
205- * @param element WebElement instance to be screen shot
204+ * @param driver WebDriver instance
205+ * @param element WebElement instance to be screen shot
206206 * @param useDevicePixelRatio whether or not take into account device pixel ratio
207- *
208207 * @return ElementSnapshot instance
209208 */
210209 public static ElementSnapshot shootElementVerticallyCentered (WebDriver driver , WebElement element , boolean useDevicePixelRatio ) {
211210 Browser browser = new Browser (driver , useDevicePixelRatio );
212211 ElementSnapshot elementSnapshot = new ElementSnapshot (driver , browser .getDevicePixelRatio ());
213212 browser .scrollToElementVerticalCentered (element );
214- elementSnapshot .setImage (browser .takeScreenshot (),browser .getBoundingClientRect (element ));
213+ elementSnapshot .setImage (browser .takeScreenshot (), browser .getBoundingClientRect (element ));
215214 return elementSnapshot ;
216215 }
217216}
0 commit comments