Bug 1430123 - Add vendor capability for old Pointer Origin behavior.
With the WebDriver spec the calculation of the pointer origin
position will no longer be done based on the top and left
position of the referenced element, but based on the center
point of the viewport.
This capability allows to turn on and off the new behavior in
Firefox 59 and following.
MozReview-Commit-ID: Ir3HpgvVg6Y
--- a/testing/geckodriver/CHANGES.md
+++ b/testing/geckodriver/CHANGES.md
@@ -1,25 +1,31 @@
Change log
==========
All notable changes to this program is documented in this file.
Unreleased
----------
+### Added
+
+- Introduced the temporary, boolean capability
+ `moz:useNonSpecCompliantPointerOrigin` to
+ disable the WebDriver conforming behavior of calculating the Pointer Origin.
+
### Changed
- HTTP status code for the [`StaleElementReference`] error changed
from 400 (Bad Request) to 404 (Not Found)
- Backtraces from geckodriver no longer substitute for missing
Marionette stacktraces
-- `Delete Session` now allows Firefox to safely shutdown within 130s before
+- `Delete Session` now allows Firefox to safely shutdown within 70s before
force-killing the process
0.19.1 (2017-10-30)
-------------------
### Changed
--- a/testing/geckodriver/README.md
+++ b/testing/geckodriver/README.md
@@ -275,16 +275,33 @@ and run. It may contain any of the follo
<tr id=capability-prefs>
<td><code>prefs</code>
<td><a href=#prefs-object><code>prefs</code></a> object
<td>Map of preference name to preference value, which can be a
string, a boolean or an integer.
</tr>
</table>
+moz:useNonSpecCompliantPointerOrigin
+------------------------------------
+
+A boolean value to indicate how the pointer origin for an action command
+will be calculated.
+
+With Firefox 59 the calculation will be based on the requirements by the
+[WebDriver] specification. This means that the pointer origin is no longer
+computed based on the top and left position of the referenced element, but
+on the in-view center point.
+
+To temporarily disable the WebDriver conformant behavior use `false` as value
+for this capability.
+
+Please note that this capability exists only temporarily, and that it will be
+removed once all Selenium bindings can handle the new behavior.
+
moz:webdriverClick
------------------
A boolean value to indicate which kind of interactability checks to run
when performing a click or sending keys to an elements. For Firefoxen prior to
version 58.0 some legacy code as imported from an older version of
[FirefoxDriver] was in use.
--- a/testing/geckodriver/src/capabilities.rs
+++ b/testing/geckodriver/src/capabilities.rs
@@ -154,23 +154,16 @@ impl<'a> BrowserCapabilities for Firefox
Ok(true)
}
fn validate_custom(&self, name: &str, value: &Json) -> WebDriverResult<()> {
if !name.starts_with("moz:") {
return Ok(())
}
match name {
- "moz:webdriverClick" => {
- if !value.is_boolean() {
- return Err(WebDriverError::new(
- ErrorStatus::InvalidArgument,
- "moz:webdriverClick is not a boolean"));
- }
- }
"moz:firefoxOptions" => {
let data = try_opt!(value.as_object(),
ErrorStatus::InvalidArgument,
"moz:firefoxOptions is not an object");
for (key, value) in data.iter() {
match &**key {
"binary" => {
if !value.is_string() {
@@ -232,16 +225,30 @@ impl<'a> BrowserCapabilities for Firefox
}
}
x => return Err(WebDriverError::new(
ErrorStatus::InvalidArgument,
format!("Invalid moz:firefoxOptions field {}", x)))
}
}
}
+ "moz:useNonSpecCompliantPointerOrigin" => {
+ if !value.is_boolean() {
+ return Err(WebDriverError::new(
+ ErrorStatus::InvalidArgument,
+ "moz:useNonSpecCompliantPointerOrigin is not a boolean"));
+ }
+ }
+ "moz:webdriverClick" => {
+ if !value.is_boolean() {
+ return Err(WebDriverError::new(
+ ErrorStatus::InvalidArgument,
+ "moz:webdriverClick is not a boolean"));
+ }
+ }
_ => return Err(WebDriverError::new(ErrorStatus::InvalidArgument,
format!("Unrecognised option {}", name)))
}
Ok(())
}
fn accept_custom(&mut self, _: &str, _: &Json, _: &Capabilities) -> WebDriverResult<bool> {
Ok(true)