Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .skipped-tests
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@
-//java/test/org/openqa/selenium/grid/router:RemoteWebDriverDownloadTest-remote
-//java/test/org/openqa/selenium/remote:RemoteWebDriverBuilderTest
-//java/test/org/openqa/selenium/remote:RemoteWebDriverScreenshotTest-remote
-//javascript/atoms:test-chrome
-//javascript/atoms:test-edge
-//javascript/atoms:test-firefox-beta
-//javascript/chrome-driver/...
-//javascript/selenium-webdriver:test-builder-test.js-chrome
-//javascript/selenium-webdriver:test-chrome-devtools-test.js-chrome
Expand Down
2 changes: 1 addition & 1 deletion javascript/atoms/action.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ bot.action.clear = function (element) {
// able to interact with this element anymore in Firefox.
bot.action.LegacyDevice_.focusOnElement(element);
if (goog.userAgent.GECKO) {
element.innerHTML = ' ';
element.textContent = ' ';
} else {
element.textContent = '';
}
Expand Down
21 changes: 18 additions & 3 deletions javascript/atoms/dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -540,10 +540,21 @@ bot.dom.isShown_ = function (elem, ignoreOpacity, displayedFn) {
// Zero-sized elements should still be considered to have positive size
// if they have a child element or text node with positive size, unless
// the element has an 'overflow' style of 'hidden'.
// Note: Text nodes containing only structural whitespace (with newlines
// or tabs) are ignored as they are likely just HTML formatting, not
// visible content.
return bot.dom.getEffectiveStyle(e, 'overflow') != 'hidden' &&
goog.array.some(e.childNodes, function (n) {
return n.nodeType == goog.dom.NodeType.TEXT ||
(bot.dom.isElement(n) && positiveSize(n));
if (n.nodeType == goog.dom.NodeType.TEXT) {
var text = n.nodeValue;
// Ignore text nodes that are purely structural whitespace
// (contain newlines or tabs and nothing else besides spaces)
if (/^[\s]*$/.test(text) && /[\n\r\t]/.test(text)) {
return false;
}
return true;
}
return bot.dom.isElement(n) && positiveSize(n);
});
}
if (!positiveSize(elem)) {
Expand Down Expand Up @@ -1412,9 +1423,13 @@ bot.dom.isNodeDistributedIntoShadowDom = function (node) {
bot.dom.appendVisibleTextLinesFromElementInComposedDom_ = function (
elem, lines) {
if (elem.shadowRoot) {
// Get the effective styles from the shadow host element for text nodes in shadow DOM
var whitespace = bot.dom.getEffectiveStyle(elem, 'white-space');
var textTransform = bot.dom.getEffectiveStyle(elem, 'text-transform');

goog.array.forEach(elem.shadowRoot.childNodes, function (node) {
bot.dom.appendVisibleTextLinesFromNodeInComposedDom_(
node, lines, true, null, null);
node, lines, true, whitespace, textTransform);
});
}

Expand Down
13 changes: 9 additions & 4 deletions javascript/atoms/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -369,10 +369,15 @@ bot.events.KeyboardEventFactory_.prototype.create = function (target, opt_args)
event.ctrlKey = args.ctrlKey;
event.metaKey = args.metaKey;
event.shiftKey = args.shiftKey;
event.keyCode = args.charCode || args.keyCode;
if (goog.userAgent.WEBKIT || goog.userAgent.EDGE) {
event.charCode = (this == bot.events.EventType.KEYPRESS) ?
event.keyCode : 0;
if (goog.userAgent.GECKO) {
event.keyCode = args.charCode ? 0 : args.keyCode;
event.charCode = args.charCode;
} else {
event.keyCode = args.charCode || args.keyCode;
if (goog.userAgent.WEBKIT || goog.userAgent.EDGE) {
event.charCode = (this == bot.events.EventType.KEYPRESS) ?
event.keyCode : 0;
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion javascript/atoms/keyboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ bot.Keyboard.prototype.maybeSubmitForm_ = function (key) {
if (key != bot.Keyboard.Keys.ENTER) {
return;
}
if (goog.userAgent.GECKO ||
if ((goog.userAgent.GECKO && !bot.userAgent.isEngineVersion(93)) ||
!bot.dom.isElement(this.getElement(), goog.dom.TagName.INPUT)) {
return;
}
Expand Down
10 changes: 5 additions & 5 deletions javascript/atoms/test/shown_test.html
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@
assertFalse(bot.dom.isShown(select));
assertTrue('Select should be visible when ignoring opacity',
bot.dom.isShown(select, true));
assertTrue(bot.dom.isShown(select.firstChild));
assertTrue(bot.dom.isShown(select.firstElementChild));
}

/** @see http://code.google.com/p/selenium/issues/detail?id=1941 */
Expand Down Expand Up @@ -374,7 +374,7 @@
function testTableRowDefaultVisibility() {
var elem = findElement({ id: 'visible-row' });
assertTrue(isShown(elem));
assertTrue(isShown(elem.firstChild));
assertTrue(isShown(elem.firstElementChild));
}

function testTableRowCollapsedVisibility() {
Expand All @@ -384,14 +384,14 @@
var elem = findElement({ id: 'collapsed-row' });
expectedFailures.run(function () {
assertFalse(isShown(elem));
assertFalse(isShown(elem.firstChild));
assertFalse(isShown(elem.firstElementChild));
});
}

function testVisibleTableRowAfterCollapsedRow() {
var elem = findElement({ id: 'post-collapsed-row' });
assertTrue(isShown(elem));
assertTrue(isShown(elem.firstChild));
assertTrue(isShown(elem.firstElementChild));
}

function testDisplayContentsOverflowIgnored() {
Expand All @@ -406,7 +406,7 @@
function testDetailsNonSummaryDescendantsVisibility() {
var contents = findElement({ id: 'non-summary' });
assertFalse(isShown(contents));
assertFalse(isShown(contents.firstChild));
assertFalse(isShown(contents.firstElementChild));
}

function testContentVisibleHidden() {
Expand Down
11 changes: 7 additions & 4 deletions javascript/atoms/test/text_shadow_test.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,18 @@
if (type == 'closed') {
document.querySelector(`closed-shadow-element`)._shadowRoot.innerHTML = html;
} else {
document.querySelector(`open-shadow-element`).shadowRoot.innerHTML = html;
// Set shadow DOM on ALL open-shadow-element instances
document.querySelectorAll(`open-shadow-element`).forEach(elem => {
elem.shadowRoot.innerHTML = html;
});
}
}

function tearDown() {
let open = document.querySelector('open-shadow-element');
document.querySelectorAll('open-shadow-element').forEach(elem => {
elem.shadowRoot.innerHTML = '';
});
let closed = document.querySelector('closed-shadow-element');

open.shadowRoot.innerHTML = '';
closed._shadowRoot.innerHTML = '';
}

Expand Down