Comparing version 7.4.6 to 7.5.0
@@ -27,2 +27,10 @@ "use strict"; | ||
} | ||
else if (using === 'shadow') { | ||
/** | ||
* `shadow/<selector>` is the way query-selector-shadow-dom | ||
* understands to query for shadow elements | ||
*/ | ||
using = 'css'; | ||
value = `shadow/${value}`; | ||
} | ||
const page = this.getPageHandle(true); | ||
@@ -29,0 +37,0 @@ return utils_1.findElement.call(this, page, using, value); |
@@ -31,4 +31,12 @@ "use strict"; | ||
} | ||
else if (using === 'shadow') { | ||
/** | ||
* `shadow/<selector>` is the way query-selector-shadow-dom | ||
* understands to query for shadow elements | ||
*/ | ||
using = 'css'; | ||
value = `shadow/${value}`; | ||
} | ||
return utils_1.findElement.call(this, elementHandle, using, value); | ||
} | ||
exports.default = findElementFromElement; |
@@ -27,2 +27,10 @@ "use strict"; | ||
} | ||
else if (using === 'shadow') { | ||
/** | ||
* `shadow/<selector>` is the way query-selector-shadow-dom | ||
* understands to query for shadow elements | ||
*/ | ||
using = 'css'; | ||
value = `shadow/${value}`; | ||
} | ||
const page = this.getPageHandle(true); | ||
@@ -29,0 +37,0 @@ return utils_1.findElements.call(this, page, using, value); |
@@ -31,4 +31,12 @@ "use strict"; | ||
} | ||
else if (using === 'shadow') { | ||
/** | ||
* `shadow/<selector>` is the way query-selector-shadow-dom | ||
* understands to query for shadow elements | ||
*/ | ||
using = 'css'; | ||
value = `shadow/${value}`; | ||
} | ||
return utils_1.findElements.call(this, elementHandle, using, value); | ||
} | ||
exports.default = findElementFromElements; |
@@ -91,3 +91,3 @@ "use strict"; | ||
exports.DEFAULT_SCRIPT_TIMEOUT = 30 * 1000; // 30s | ||
exports.SUPPORTED_SELECTOR_STRATEGIES = ['css selector', 'tag name', 'xpath', 'link text', 'partial link text']; | ||
exports.SUPPORTED_SELECTOR_STRATEGIES = ['css selector', 'tag name', 'xpath', 'link text', 'partial link text', 'shadow']; | ||
exports.SERIALIZE_PROPERTY = 'data-devtoolsdriver-fetchedElement'; | ||
@@ -94,0 +94,0 @@ exports.SERIALIZE_FLAG = '__executeElement'; |
@@ -5,2 +5,3 @@ import type { Browser } from 'puppeteer-core/lib/cjs/puppeteer/common/Browser'; | ||
import type { CommandEndpoint } from '@wdio/protocols'; | ||
import type { Frame } from 'puppeteer-core/lib/cjs/puppeteer/common/FrameManager'; | ||
import ElementStore from './elementstore'; | ||
@@ -24,3 +25,3 @@ export default class DevToolsDriver { | ||
dialogHandler(dialog: Dialog): void; | ||
framenavigatedHandler(frame: Page): void; | ||
framenavigatedHandler(frame: Frame): void; | ||
setTimeouts(implicit?: number, pageLoad?: number, script?: number): void; | ||
@@ -27,0 +28,0 @@ getPageHandle(isInFrame?: boolean): Page; |
@@ -116,3 +116,3 @@ "use strict"; | ||
this.currentFrameUrl = frame.url(); | ||
this.elementStore.clear(); | ||
this.elementStore.clear(frame.parentFrame() ? frame : undefined); | ||
} | ||
@@ -119,0 +119,0 @@ setTimeouts(implicit, pageLoad, script) { |
import type { ElementHandle } from 'puppeteer-core/lib/cjs/puppeteer/common/JSHandle'; | ||
import type { Frame } from 'puppeteer-core/lib/cjs/puppeteer/common/FrameManager'; | ||
export default class ElementStore { | ||
private _index; | ||
private _elementMap; | ||
private _frameMap; | ||
set(elementHandle: ElementHandle): string; | ||
get(index: string): Promise<ElementHandle<Element> | undefined>; | ||
clear(): void; | ||
clear(frame?: Frame): void; | ||
} | ||
//# sourceMappingURL=elementstore.d.ts.map |
@@ -7,2 +7,3 @@ "use strict"; | ||
this._elementMap = new Map(); | ||
this._frameMap = new Map(); | ||
} | ||
@@ -12,2 +13,11 @@ set(elementHandle) { | ||
this._elementMap.set(index, elementHandle); | ||
const frame = elementHandle.executionContext().frame(); | ||
if (frame) { | ||
let elementIndexes = this._frameMap.get(frame); | ||
if (!elementIndexes) { | ||
elementIndexes = new Set(); | ||
this._frameMap.set(frame, elementIndexes); | ||
} | ||
elementIndexes.add(index); | ||
} | ||
return index; | ||
@@ -26,6 +36,15 @@ } | ||
} | ||
clear() { | ||
this._elementMap.clear(); | ||
clear(frame) { | ||
if (!frame) { | ||
this._elementMap.clear(); | ||
this._frameMap.clear(); | ||
return; | ||
} | ||
const elementIndexes = this._frameMap.get(frame); | ||
if (elementIndexes) { | ||
elementIndexes.forEach((elementIndex) => this._elementMap.delete(elementIndex)); | ||
this._frameMap.delete(frame); | ||
} | ||
} | ||
} | ||
exports.default = ElementStore; |
@@ -9,2 +9,3 @@ "use strict"; | ||
const logger_1 = __importDefault(require("@wdio/logger")); | ||
const puppeteer_1 = require("query-selector-shadow-dom/plugins/puppeteer"); | ||
const finder_1 = __importDefault(require("./finder")); | ||
@@ -147,4 +148,6 @@ const utils_1 = require("./utils"); | ||
} | ||
function launch(capabilities) { | ||
async function launch(capabilities) { | ||
var _a; | ||
puppeteer_core_1.default.unregisterCustomQueryHandler('shadow'); | ||
puppeteer_core_1.default.registerCustomQueryHandler('shadow', puppeteer_1.QueryHandler); | ||
const browserName = (_a = capabilities.browserName) === null || _a === void 0 ? void 0 : _a.toLowerCase(); | ||
@@ -151,0 +154,0 @@ /** |
{ | ||
"name": "devtools", | ||
"version": "7.4.6", | ||
"version": "7.5.0", | ||
"description": "A Chrome DevTools protocol binding that maps WebDriver commands into Chrome DevTools commands using Puppeteer", | ||
@@ -25,3 +25,3 @@ "author": "Christian Bromann <christian@saucelabs.com>", | ||
"dependencies": { | ||
"@wdio/config": "7.4.2", | ||
"@wdio/config": "7.5.0", | ||
"@wdio/logger": "7.4.2", | ||
@@ -34,2 +34,3 @@ "@wdio/protocols": "7.4.2", | ||
"puppeteer-core": "^7.1.0", | ||
"query-selector-shadow-dom": "^1.0.0", | ||
"ua-parser-js": "^0.7.21", | ||
@@ -42,3 +43,3 @@ "uuid": "^8.0.0" | ||
}, | ||
"gitHead": "1f2f7d699470dab3d1a68a74da337a5d6ee7559a" | ||
"gitHead": "18f0581fe366c14d678b05206c2fa5b15d4e701e" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
217753
4021
11
+ Added@wdio/config@7.5.0(transitive)
+ Addedquery-selector-shadow-dom@1.0.1(transitive)
- Removed@wdio/config@7.4.2(transitive)
Updated@wdio/config@7.5.0