diff --git a/flutter-by/wdio-flutter-by-service/package-lock.json b/flutter-by/wdio-flutter-by-service/package-lock.json index 444016e..af65007 100644 --- a/flutter-by/wdio-flutter-by-service/package-lock.json +++ b/flutter-by/wdio-flutter-by-service/package-lock.json @@ -1,12 +1,12 @@ { "name": "wdio-flutter-by-service", - "version": "1.0.13", + "version": "1.0.14", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "wdio-flutter-by-service", - "version": "1.0.13", + "version": "1.0.14", "license": "MIT License", "dependencies": { "@wdio/globals": "^8.38.0", diff --git a/flutter-by/wdio-flutter-by-service/package.json b/flutter-by/wdio-flutter-by-service/package.json index 8d3ede3..ef388f4 100644 --- a/flutter-by/wdio-flutter-by-service/package.json +++ b/flutter-by/wdio-flutter-by-service/package.json @@ -1,6 +1,6 @@ { "name": "wdio-flutter-by-service", - "version": "1.0.13", + "version": "1.0.14", "description": "", "scripts": { "build": "rimraf build && tsc -b", diff --git a/flutter-by/wdio-flutter-by-service/src/utils.ts b/flutter-by/wdio-flutter-by-service/src/utils.ts index c9081d7..d0ddea3 100644 --- a/flutter-by/wdio-flutter-by-service/src/utils.ts +++ b/flutter-by/wdio-flutter-by-service/src/utils.ts @@ -3,6 +3,7 @@ import { command } from 'webdriver'; import { browser } from '@wdio/globals'; import path from 'path'; import { createRequire } from 'module'; +import { pathToFileURL } from 'url'; const require = createRequire(import.meta.url); @@ -10,9 +11,10 @@ const constructElementObject = async function () { const wdioPath = require.resolve('webdriverio'); const pathToMatch = path.join('cjs', 'index.js'); const pathToReplace = path.join('utils', 'getElementObject.js'); - return ( - await import(path.join(wdioPath.replace(pathToMatch, ''), pathToReplace)) - ).getElement; + const targetPath = path.join(wdioPath.replace(pathToMatch, ''), pathToReplace); + const fileUrl = pathToFileURL(targetPath); + + return (await import(fileUrl.href)).getElement; }; const flutterElementFinder = function (