Comparing version 1.7.5 to 1.7.6
@@ -261,4 +261,13 @@ /* global window:false */ | ||
function getPostData(arrayValue) { | ||
if (self.session.capabilities.isWebDriver) { | ||
return { value: arrayValue.join('').split('') }; | ||
var capabilities = self.session.capabilities; | ||
if (capabilities.isWebDriver || capabilities.valueParameterCalledText) { | ||
if (capabilities.valueParameterCalledText) { | ||
// The WebDriver version of `/value` requires the value | ||
// property to be named `text` and to contain a string. | ||
return { text: arrayValue.join('') }; | ||
} else { | ||
// Browsers that support WebDriver but use the `value` | ||
// property require it to be a flat array of characters. | ||
return { value: arrayValue.join('').split('') }; | ||
} | ||
} | ||
@@ -268,2 +277,11 @@ return { value: arrayValue }; | ||
function handleError(error) { | ||
if (error.detail.error === 'invalid argument' && | ||
!self.session.capabilities.valueParameterCalledText) { | ||
self.session.capabilities.valueParameterCalledText = true; | ||
return self.type(value); | ||
} | ||
throw error; | ||
} | ||
var self = this; | ||
@@ -283,3 +301,3 @@ | ||
return this.session._uploadFile(filename).then(function(uploadedFilename) { | ||
return self._post('value', getPostData([ uploadedFilename ])).then(noop); | ||
return self._post('value', getPostData([ uploadedFilename ])).then(noop).catch(handleError); | ||
}); | ||
@@ -294,3 +312,3 @@ } | ||
// If the input isn't a filename, just post the value directly | ||
return this._post('value', getPostData(value)).then(noop); | ||
return this._post('value', getPostData(value)).then(noop).catch(handleError); | ||
}, | ||
@@ -297,0 +315,0 @@ |
{ | ||
"name": "leadfoot", | ||
"version": "1.7.5", | ||
"version": "1.7.6", | ||
"description": "Leadfoot. A JavaScript client library that brings cross-platform consistency to the Selenium WebDriver API.", | ||
@@ -34,2 +34,2 @@ "repository": { | ||
} | ||
} | ||
} |
@@ -418,2 +418,18 @@ /* global document:false */ | ||
// WebDriver Spec now supports execute/sync as the synchronous | ||
// execute endpoint. This was updated in geckodriver as of 16.0 | ||
// but not yet completed in chromedriver. | ||
capabilities.useExecuteSyncEndpoint = false; | ||
// WebDriver Spec now supports [POST] /value receiving a | ||
// parameter named 'text' as a string instead of an array of | ||
// charactrers named 'value'. This was updated in geckodriver as | ||
// of 16.0 but not yet completed in chromedriver. | ||
capabilities.valueParameterCalledText = false; | ||
// Webdriver spec now supoorts GET endpoint for Active Element | ||
// call. This was updated in geckodriver as of 16.0 but not yet | ||
// implemented in chromedriver. | ||
capabilities.useGetForActiveElement = false; | ||
function supported() { return true; } | ||
@@ -420,0 +436,0 @@ function unsupported() { return false; } |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
314685
20
6490