Skip to content

Commit

Permalink
feat(base-driver): Add more shadow root-related W3C routes (#16700)
Browse files Browse the repository at this point in the history
  • Loading branch information
mykola-mokhnach committed Mar 31, 2022
1 parent 4f41ec3 commit d8a9b4d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
6 changes: 6 additions & 0 deletions packages/base-driver/lib/protocol/routes.js
Expand Up @@ -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'}
},
Expand Down
2 changes: 1 addition & 1 deletion packages/base-driver/test/unit/protocol/routes.spec.js
Expand Up @@ -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');
});
});

Expand Down
10 changes: 10 additions & 0 deletions packages/types/src/index.ts
Expand Up @@ -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>;
Expand Down

0 comments on commit d8a9b4d

Please sign in to comment.