diff --git a/lib/commands/gesture.js b/lib/commands/gesture.js index 7188d872e..a4cd1ed12 100644 --- a/lib/commands/gesture.js +++ b/lib/commands/gesture.js @@ -301,7 +301,7 @@ helpers.handlePinchOrZoom = async function (actions) { helpers.mobileScroll = async function (opts={}, swipe=false) { if (!opts.element) { - opts.element = await this.findElement(`class name`, `XCUIElementTypeApplication`); + opts.element = await this.findNativeElementOrElements(`class name`, `XCUIElementTypeApplication`, false); } // WDA supports four scrolling strategies: predication based on name, direction, // predicateString, and toVisible, in that order. Swiping requires direction. diff --git a/test/functional/web/safari-execute-e2e-specs.js b/test/functional/web/safari-execute-e2e-specs.js index 4db78ac1f..cbaec3ef4 100644 --- a/test/functional/web/safari-execute-e2e-specs.js +++ b/test/functional/web/safari-execute-e2e-specs.js @@ -31,6 +31,12 @@ describe('safari - execute', function () { await deleteSession(); }); + describe('mobile: x methods', function () { + it('should run in native context', async () => { + await driver.execute('mobile: scroll', {direction: 'down'}).should.not.be.rejected; + }); + }); + describe('synchronous', function () { it('should bubble up javascript errors', async () => { await driver.execute(`'nan'--`).should.eventually.be.rejected;