File tree Expand file tree Collapse file tree 5 files changed +27
-1
lines changed Expand file tree Collapse file tree 5 files changed +27
-1
lines changed Original file line number Diff line number Diff line change
1
+ ## v2.49.0-dev
2
+
3
+ * Added ` WebElement#takeScreenshot() ` .
4
+
1
5
## v2.48.1
2
6
3
7
* FIXED: Adjusted how the control flow tracks promise callbacks to avoid a
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " selenium-webdriver" ,
3
- "version" : " 2.48.1 " ,
3
+ "version" : " 2.49.0-dev " ,
4
4
"description" : " The official WebDriver JavaScript bindings from the Selenium project" ,
5
5
"license" : " Apache-2.0" ,
6
6
"keywords" : [
Original file line number Diff line number Diff line change @@ -163,6 +163,7 @@ webdriver.CommandName = {
163
163
ELEMENT_EQUALS : 'elementEquals' ,
164
164
165
165
SCREENSHOT : 'screenshot' ,
166
+ TAKE_ELEMENT_SCREENSHOT : 'takeElementScreenshot' ,
166
167
IMPLICITLY_WAIT : 'implicitlyWait' ,
167
168
SET_SCRIPT_TIMEOUT : 'setScriptTimeout' ,
168
169
SET_TIMEOUT : 'setTimeout' ,
Original file line number Diff line number Diff line change @@ -283,6 +283,8 @@ webdriver.http.Executor.COMMAND_MAP_ = (function() {
283
283
get ( '/session/:sessionId/element/:id/css/:propertyName' ) ) .
284
284
put ( webdriver . CommandName . ELEMENT_EQUALS ,
285
285
get ( '/session/:sessionId/element/:id/equals/:other' ) ) .
286
+ put ( webdriver . CommandName . TAKE_ELEMENT_SCREENSHOT ,
287
+ get ( '/session/:sessionId/element/:id/screenshot' ) ) .
286
288
put ( webdriver . CommandName . SWITCH_TO_WINDOW ,
287
289
post ( '/session/:sessionId/window' ) ) .
288
290
put ( webdriver . CommandName . MAXIMIZE_WINDOW ,
Original file line number Diff line number Diff line change @@ -2187,6 +2187,25 @@ webdriver.WebElement.prototype.isDisplayed = function() {
2187
2187
} ;
2188
2188
2189
2189
2190
+ /**
2191
+ * Take a screenshot of the visible region encompassed by this element's
2192
+ * bounding rectangle.
2193
+ *
2194
+ * @param {boolean= } opt_scroll Optional argument that indicates whether the
2195
+ * element should be scrolled into view before taking a screenshot. Defaults
2196
+ * to false.
2197
+ * @return {!webdriver.promise.Promise.<string> } A promise that will be
2198
+ * resolved to the screenshot as a base-64 encoded PNG.
2199
+ */
2200
+ webdriver . WebElement . prototype . takeScreenshot = function ( opt_scroll ) {
2201
+ var scroll = ! ! opt_scroll ;
2202
+ return this . schedule_ (
2203
+ new webdriver . Command ( webdriver . CommandName . TAKE_ELEMENT_SCREENSHOT )
2204
+ . setParameter ( 'scroll' , scroll ) ,
2205
+ 'WebElement.takeScreenshot(' + scroll + ')' ) ;
2206
+ } ;
2207
+
2208
+
2190
2209
/**
2191
2210
* Schedules a command to retrieve the outer HTML of this element.
2192
2211
* @return {!webdriver.promise.Promise.<string> } A promise that will be
You can’t perform that action at this time.
0 commit comments