Commit fa129e69 authored by John Chen's avatar John Chen Committed by Commit Bot

[ChromeDriver] Update atoms and fix Clear Element

Update atoms with the latest version from Selenium, to fix several bugs,
including fixing Clear Element for several input element types.

Bug: chromedriver:1319
Change-Id: Ic6141712ba914f7b97d341dc9d4123fc25b05e50
Reviewed-on: https://chromium-review.googlesource.com/c/1258244Reviewed-by: default avatarCaleb Rouleau <crouleau@chromium.org>
Commit-Queue: John Chen <johnchen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#596017}
parent 1a3f3f12
...@@ -12,6 +12,14 @@ import fnmatch ...@@ -12,6 +12,14 @@ import fnmatch
_REVISION_NEGATIVE_FILTER = {} _REVISION_NEGATIVE_FILTER = {}
_REVISION_NEGATIVE_FILTER['HEAD'] = [ _REVISION_NEGATIVE_FILTER['HEAD'] = [
# marked as not yet implemented with chrome but already works
'ChildrenFindingTest.testShouldNotReturnRootElementWhenFindingChildrenById',
'ClearTest.shouldBeAbleToClearDateInput',
'ClearTest.shouldBeAbleToClearDatetimeLocalInput',
'ClearTest.shouldBeAbleToClearMonthInput',
'ClearTest.shouldBeAbleToClearTimeInput',
'ClearTest.shouldBeAbleToClearWeekInput',
# Flaky: https://bugs.chromium.org/p/chromedriver/issues/detail?id=528 # Flaky: https://bugs.chromium.org/p/chromedriver/issues/detail?id=528
'PageLoadingTest.testShouldDoNothingIfThereIsNothingToGoBackTo', 'PageLoadingTest.testShouldDoNothingIfThereIsNothingToGoBackTo',
......
...@@ -18,7 +18,7 @@ Contents: ...@@ -18,7 +18,7 @@ Contents:
atoms.h, atoms.cc atoms.h, atoms.cc
These atoms are generated by the webdriver team and are to be checked in These atoms are generated by the webdriver team and are to be checked in
manually. The current version was generated from revision manually. The current version was generated from revision
381f815652933f7077762ffba5f18794ab88c9b5. a3444b8f4dbb6e83b8710455e6d8352439ac1874.
To generate the atoms using the code found in selenium tree: To generate the atoms using the code found in selenium tree:
$ git clone https://github.com/SeleniumHQ/selenium.git $ git clone https://github.com/SeleniumHQ/selenium.git
......
This source diff could not be displayed because it is too large. You can view the blob instead.
diff --git a/javascript/atoms/dom.js b/javascript/atoms/dom.js diff --git a/javascript/atoms/dom.js b/javascript/atoms/dom.js
index f0a3b84da5..c7a1b05054 100644 index 78b78e1038..f1d0b424b0 100644
--- a/javascript/atoms/dom.js --- a/javascript/atoms/dom.js
+++ b/javascript/atoms/dom.js +++ b/javascript/atoms/dom.js
@@ -561,14 +561,8 @@ bot.dom.isShown = function(elem, opt_ignoreOpacity) { @@ -587,14 +587,8 @@ bot.dom.isShown = function(elem, opt_ignoreOpacity) {
do { var parent = bot.dom.getParentNodeInComposedDom(e);
parent = bot.dom.getParentNodeInComposedDom(e);
if (parent instanceof ShadowRoot) { if (bot.dom.IS_SHADOW_DOM_ENABLED && (parent instanceof ShadowRoot)) {
- if (parent.host.shadowRoot != parent) { - if (parent.host.shadowRoot !== parent) {
- // There is a younger shadow root, which will take precedence over - // There is a younger shadow root, which will take precedence over
- // the shadow this element is in, thus this element won't be - // the shadow this element is in, thus this element won't be
- // displayed. - // displayed.
- return false; - return false;
- } else { - } else {
- parent = parent.host; - parent = parent.host;
- } - }
+ // For backward compatibility, treat all shadow roots as shown. + // For backward compatibility, treat all shadow roots as shown.
+ return true; + return true;
} else if (parent && (parent.nodeType == goog.dom.NodeType.DOCUMENT || }
parent.nodeType == goog.dom.NodeType.DOCUMENT_FRAGMENT)) {
parent = null; if (parent && (parent.nodeType == goog.dom.NodeType.DOCUMENT ||
@@ -602,7 +596,7 @@ bot.dom.isShown = function(elem, opt_ignoreOpacity) {
return true;
}
- return parent && displayed(parent);
+ return !!parent && displayed(parent);
}
return bot.dom.isShown_(elem, !!opt_ignoreOpacity, displayed);
diff --git a/javascript/atoms/mouse.js b/javascript/atoms/mouse.js diff --git a/javascript/atoms/mouse.js b/javascript/atoms/mouse.js
index 737ed50f62..1bc9e858f5 100644 index 737ed50f62..1bc9e858f5 100644
--- a/javascript/atoms/mouse.js --- a/javascript/atoms/mouse.js
...@@ -44,24 +53,22 @@ index 737ed50f62..1bc9e858f5 100644 ...@@ -44,24 +53,22 @@ index 737ed50f62..1bc9e858f5 100644
buttonValueMap[bot.events.EventType.CLICK] = [0, 1, 2, null]; buttonValueMap[bot.events.EventType.CLICK] = [0, 1, 2, null];
buttonValueMap[bot.events.EventType.CONTEXTMENU] = [null, null, 2, null]; buttonValueMap[bot.events.EventType.CONTEXTMENU] = [null, null, 2, null];
diff --git a/javascript/chrome-driver/atoms.js b/javascript/chrome-driver/atoms.js diff --git a/javascript/chrome-driver/atoms.js b/javascript/chrome-driver/atoms.js
index 5cf4416460..b21fea617c 100644 index 5cf4416460..329390cf1f 100644
--- a/javascript/chrome-driver/atoms.js --- a/javascript/chrome-driver/atoms.js
+++ b/javascript/chrome-driver/atoms.js +++ b/javascript/chrome-driver/atoms.js
@@ -142,6 +142,12 @@ webdriver.chrome.scrollIntoView_ = function(elem, region, center) { @@ -142,6 +142,10 @@ webdriver.chrome.scrollIntoView_ = function(elem, region, center) {
offset = goog.style.getClientPosition(elem); offset = goog.style.getClientPosition(elem);
var windowSize = goog.dom.getDomHelper(elem).getViewportSize(); var windowSize = goog.dom.getDomHelper(elem).getViewportSize();
+ // Chrome 61.0.3138 and above uses doc.documentElement, while older + // Chrome uses either doc.documentElement or doc.body, depending on
+ // Chrome uses doc.body. We can't reliably detect Chrome version because + // compatibility settings. For reliability, call scrollHelper on both.
+ // userAgent string can be overridden, so just call scrollHelper on both. + // Calling scrollHelper on the wrong object is harmless.
+ // TBD(johnchen@chromium.org): Remove doc.body when we stop supporting
+ // Chrome 61.0.3137.
+ scrollHelper(doc.documentElement, windowSize, offset, region, center); + scrollHelper(doc.documentElement, windowSize, offset, region, center);
scrollHelper(doc.body, windowSize, offset, region, center); scrollHelper(doc.body, windowSize, offset, region, center);
}; };
diff --git a/rake-tasks/crazy_fun/mappings/javascript.rb b/rake-tasks/crazy_fun/mappings/javascript.rb diff --git a/rake-tasks/crazy_fun/mappings/javascript.rb b/rake-tasks/crazy_fun/mappings/javascript.rb
index 982d36314e..ae0c3e460b 100644 index 1ac2b2066a..dfa11fbbc2 100644
--- a/rake-tasks/crazy_fun/mappings/javascript.rb --- a/rake-tasks/crazy_fun/mappings/javascript.rb
+++ b/rake-tasks/crazy_fun/mappings/javascript.rb +++ b/rake-tasks/crazy_fun/mappings/javascript.rb
@@ -857,6 +857,8 @@ module Javascript @@ -857,6 +857,8 @@ module Javascript
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment