diff --git a/src/browser/client-scripts/index.js b/src/browser/client-scripts/index.js index a5b7f3e32..4106d69d2 100644 --- a/src/browser/client-scripts/index.js +++ b/src/browser/client-scripts/index.js @@ -177,7 +177,8 @@ function disableFrameAnimationsUnsafe() { window.__cleanupAnimation = function () { for (var i = 0; i < styleElements.length; i++) { - styleElements[i].remove(); + // IE11 doesn't have remove() on node + styleElements[i].parentNode.removeChild(styleElements[i]); } delete window.__cleanupAnimation; diff --git a/src/browser/client-scripts/util.js b/src/browser/client-scripts/util.js index 337cc8760..e6438101a 100644 --- a/src/browser/client-scripts/util.js +++ b/src/browser/client-scripts/util.js @@ -93,7 +93,8 @@ exports.forEachRoot = function (cb) { function traverseRoots(root) { cb(root); - var treeWalker = document.createTreeWalker(root, NodeFilter.SHOW_ELEMENT); + // In IE 11, we need to pass the third and fourth arguments + var treeWalker = document.createTreeWalker(root, NodeFilter.SHOW_ELEMENT, null, false); for (var node = treeWalker.currentNode; node !== null; node = treeWalker.nextNode()) { if (node instanceof Element && node.shadowRoot) { diff --git a/src/browser/commands/scrollIntoView.ts b/src/browser/commands/scrollIntoView.ts index 6fb1d915d..389c39326 100644 --- a/src/browser/commands/scrollIntoView.ts +++ b/src/browser/commands/scrollIntoView.ts @@ -14,7 +14,9 @@ export = async (browser: Browser): Promise => { options: ScrollIntoViewOptions | boolean = { block: "start", inline: "nearest" }, ): Promise { await session.execute, [WebdriverIO.Element, ScrollIntoViewOptions | boolean]>( - (elem, options) => elem.scrollIntoView(options), + function (elem, options) { + return elem.scrollIntoView(options); + }, this, options, );