feat(base-driver): Add more shadow root-related W3C routes
MODIFY
packages/base-driver/lib/protocol/routes.js
packages/base-driver/lib/protocol/routes.js
@@ -243,6 +243,12 @@ const METHOD_MAP = {
'/session/:sessionId/element/:elementId/shadow': {
GET: {command: 'elementShadowRoot'}
},
+ '/session/:sessionId/shadow/:shadowId/element': {
+ POST: {command: 'findElementFromShadowRoot', payloadParams: {required: ['using', 'value']}}
+ },
+ '/session/:sessionId/shadow/:shadowId/elements': {
+ POST: {command: 'findElementsFromShadowRoot', payloadParams: {required: ['using', 'value']}}
+ },
'/session/:sessionId/element/:elementId/css/:propertyName': {
GET: {command: 'getCssProperty'}
},

MODIFY
packages/base-driver/test/unit/protocol/routes.spec.js
packages/base-driver/test/unit/protocol/routes.spec.js
@@ -38,7 +38,7 @@ describe('Protocol', function () {
}
let hash = shasum.digest('hex').substring(0, 8);
// Modify the hash whenever the protocol has intentionally been modified.
- hash.should.equal('262ca3c4');
+ hash.should.equal('7d48d815');
});
});

MODIFY
packages/types/src/index.ts
packages/types/src/index.ts
@@ -246,6 +246,16 @@ export interface ExternalDriver extends Driver {
getLocationInView?(elementId: string): Promise<Position>;
getSize?(elementId: string): Promise<Size>;
elementShadowRoot?(elementId: string): Promise<Element>;
+ findElementFromShadowRoot?(
+ strategy: string,
+ selector: string,
+ shadowId: string
+ ): Promise<Element>;
+ findElementsFromShadowRoot?(
+ strategy: string,
+ selector: string,
+ shadowId: string
+ ): Promise<Element[]>;
equalsElement?(elementId: string, otherElementId: string): Promise<boolean>;
submit?(elementId: string): Promise<void>;
keys?(value: string[]): Promise<void>;

feat(base-driver): Add more shadow root-related W3C routes (#16700)