selenium-webdriver 4.43.0 → 4.45.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGES.md +21 -0
- package/README.md +57 -185
- package/bidi/browsingContextInspector.js +1 -1
- package/bidi/generated/bluetooth.d.ts +223 -0
- package/bidi/generated/bluetooth.js +154 -0
- package/bidi/generated/browser.d.ts +104 -0
- package/bidi/generated/browser.js +107 -0
- package/bidi/generated/browsing_context.d.ts +394 -0
- package/bidi/generated/browsing_context.js +260 -0
- package/bidi/generated/common.d.ts +38 -0
- package/bidi/generated/common.js +30 -0
- package/bidi/generated/emulation.d.ts +176 -0
- package/bidi/generated/emulation.js +133 -0
- package/bidi/generated/input.d.ts +151 -0
- package/bidi/generated/input.js +81 -0
- package/bidi/generated/log.d.ts +39 -0
- package/bidi/generated/log.js +67 -0
- package/bidi/generated/network.d.ts +359 -0
- package/bidi/generated/network.js +230 -0
- package/bidi/generated/permissions.d.ts +22 -0
- package/bidi/generated/permissions.js +43 -0
- package/bidi/generated/script.d.ts +410 -0
- package/bidi/generated/script.js +146 -0
- package/bidi/generated/session.d.ts +119 -0
- package/bidi/generated/session.js +82 -0
- package/bidi/generated/speculation.d.ts +17 -0
- package/bidi/generated/speculation.js +40 -0
- package/bidi/generated/storage.d.ts +84 -0
- package/bidi/generated/storage.js +70 -0
- package/bidi/generated/user_agent_client_hints.d.ts +33 -0
- package/bidi/generated/user_agent_client_hints.js +43 -0
- package/bidi/generated/webextension.d.ts +42 -0
- package/bidi/generated/webextension.js +53 -0
- package/bidi/index.js +133 -21
- package/bin/linux/selenium-manager +0 -0
- package/bin/macos/selenium-manager +0 -0
- package/bin/windows/selenium-manager.exe +0 -0
- package/common/driverFinder.js +2 -1
- package/common/seleniumManager.js +1 -1
- package/eslint.config.js +5 -5
- package/io/zip.js +1 -1
- package/lib/atoms/find-elements.js +272 -68
- package/lib/atoms/get-attribute.js +152 -17
- package/lib/atoms/is-displayed.js +385 -39
- package/lib/http.js +2 -1
- package/lib/pinnedScript.js +0 -1
- package/lib/webdriver.js +2 -2
- package/package.json +18 -16
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Licensed to the Software Freedom Conservancy (SFC) under one
|
|
3
|
+
// or more contributor license agreements. See the NOTICE file
|
|
4
|
+
// distributed with this work for additional information
|
|
5
|
+
// regarding copyright ownership. The SFC licenses this file
|
|
6
|
+
// to you under the Apache License, Version 2.0 (the
|
|
7
|
+
// "License"); you may not use this file except in compliance
|
|
8
|
+
// with the License. You may obtain a copy of the License at
|
|
9
|
+
//
|
|
10
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
//
|
|
12
|
+
// Unless required by applicable law or agreed to in writing,
|
|
13
|
+
// software distributed under the License is distributed on an
|
|
14
|
+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
15
|
+
// KIND, either express or implied. See the License for the
|
|
16
|
+
// specific language governing permissions and limitations
|
|
17
|
+
// under the License.
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.Bluetooth = void 0;
|
|
20
|
+
// --- Implementation ---
|
|
21
|
+
class Bluetooth {
|
|
22
|
+
constructor(bidi) {
|
|
23
|
+
this.bidi = bidi;
|
|
24
|
+
}
|
|
25
|
+
static async create(driver) {
|
|
26
|
+
const caps = await driver.getCapabilities();
|
|
27
|
+
if (!caps.get('webSocketUrl')) {
|
|
28
|
+
throw new Error('WebDriver instance must support BiDi protocol');
|
|
29
|
+
}
|
|
30
|
+
const bidi = await driver.getBidi();
|
|
31
|
+
return new Bluetooth(bidi);
|
|
32
|
+
}
|
|
33
|
+
async handleRequestDevicePrompt(params) {
|
|
34
|
+
const response = await this.bidi.send({
|
|
35
|
+
method: 'bluetooth.handleRequestDevicePrompt',
|
|
36
|
+
params: params,
|
|
37
|
+
});
|
|
38
|
+
if (response['type'] === 'error') {
|
|
39
|
+
throw new Error(`${response['error']}: ${response['message']}`);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
async simulateAdapter(params) {
|
|
43
|
+
const response = await this.bidi.send({
|
|
44
|
+
method: 'bluetooth.simulateAdapter',
|
|
45
|
+
params: params,
|
|
46
|
+
});
|
|
47
|
+
if (response['type'] === 'error') {
|
|
48
|
+
throw new Error(`${response['error']}: ${response['message']}`);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
async disableSimulation(params) {
|
|
52
|
+
const response = await this.bidi.send({
|
|
53
|
+
method: 'bluetooth.disableSimulation',
|
|
54
|
+
params: params,
|
|
55
|
+
});
|
|
56
|
+
if (response['type'] === 'error') {
|
|
57
|
+
throw new Error(`${response['error']}: ${response['message']}`);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
async simulatePreconnectedPeripheral(params) {
|
|
61
|
+
const response = await this.bidi.send({
|
|
62
|
+
method: 'bluetooth.simulatePreconnectedPeripheral',
|
|
63
|
+
params: params,
|
|
64
|
+
});
|
|
65
|
+
if (response['type'] === 'error') {
|
|
66
|
+
throw new Error(`${response['error']}: ${response['message']}`);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
async simulateAdvertisement(params) {
|
|
70
|
+
const response = await this.bidi.send({
|
|
71
|
+
method: 'bluetooth.simulateAdvertisement',
|
|
72
|
+
params: params,
|
|
73
|
+
});
|
|
74
|
+
if (response['type'] === 'error') {
|
|
75
|
+
throw new Error(`${response['error']}: ${response['message']}`);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
async simulateGattConnectionResponse(params) {
|
|
79
|
+
const response = await this.bidi.send({
|
|
80
|
+
method: 'bluetooth.simulateGattConnectionResponse',
|
|
81
|
+
params: params,
|
|
82
|
+
});
|
|
83
|
+
if (response['type'] === 'error') {
|
|
84
|
+
throw new Error(`${response['error']}: ${response['message']}`);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
async simulateGattDisconnection(params) {
|
|
88
|
+
const response = await this.bidi.send({
|
|
89
|
+
method: 'bluetooth.simulateGattDisconnection',
|
|
90
|
+
params: params,
|
|
91
|
+
});
|
|
92
|
+
if (response['type'] === 'error') {
|
|
93
|
+
throw new Error(`${response['error']}: ${response['message']}`);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
async simulateService(params) {
|
|
97
|
+
const response = await this.bidi.send({
|
|
98
|
+
method: 'bluetooth.simulateService',
|
|
99
|
+
params: params,
|
|
100
|
+
});
|
|
101
|
+
if (response['type'] === 'error') {
|
|
102
|
+
throw new Error(`${response['error']}: ${response['message']}`);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
async simulateCharacteristic(params) {
|
|
106
|
+
const response = await this.bidi.send({
|
|
107
|
+
method: 'bluetooth.simulateCharacteristic',
|
|
108
|
+
params: params,
|
|
109
|
+
});
|
|
110
|
+
if (response['type'] === 'error') {
|
|
111
|
+
throw new Error(`${response['error']}: ${response['message']}`);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
async simulateCharacteristicResponse(params) {
|
|
115
|
+
const response = await this.bidi.send({
|
|
116
|
+
method: 'bluetooth.simulateCharacteristicResponse',
|
|
117
|
+
params: params,
|
|
118
|
+
});
|
|
119
|
+
if (response['type'] === 'error') {
|
|
120
|
+
throw new Error(`${response['error']}: ${response['message']}`);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
async simulateDescriptor(params) {
|
|
124
|
+
const response = await this.bidi.send({
|
|
125
|
+
method: 'bluetooth.simulateDescriptor',
|
|
126
|
+
params: params,
|
|
127
|
+
});
|
|
128
|
+
if (response['type'] === 'error') {
|
|
129
|
+
throw new Error(`${response['error']}: ${response['message']}`);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
async simulateDescriptorResponse(params) {
|
|
133
|
+
const response = await this.bidi.send({
|
|
134
|
+
method: 'bluetooth.simulateDescriptorResponse',
|
|
135
|
+
params: params,
|
|
136
|
+
});
|
|
137
|
+
if (response['type'] === 'error') {
|
|
138
|
+
throw new Error(`${response['error']}: ${response['message']}`);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
async onRequestDevicePromptUpdated(callback) {
|
|
142
|
+
await this.bidi.subscribe('bluetooth.requestDevicePromptUpdated');
|
|
143
|
+
this.bidi.on('bluetooth.requestDevicePromptUpdated', (params) => {
|
|
144
|
+
callback(params);
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
async onGattConnectionAttempted(callback) {
|
|
148
|
+
await this.bidi.subscribe('bluetooth.gattConnectionAttempted');
|
|
149
|
+
this.bidi.on('bluetooth.gattConnectionAttempted', (params) => {
|
|
150
|
+
callback(params);
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
exports.Bluetooth = Bluetooth;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import type { EmptyParams, EmptyResult, JsInt, JsUint } from './common.js';
|
|
2
|
+
import type { SessionProxyConfiguration, SessionUserPromptHandler } from './session.js';
|
|
3
|
+
export type BrowserCommand = BrowserClose | BrowserCreateUserContext | BrowserGetClientWindows | BrowserGetUserContexts | BrowserRemoveUserContext | BrowserSetClientWindowState | BrowserSetDownloadBehavior;
|
|
4
|
+
export type BrowserResult = BrowserCloseResult | BrowserCreateUserContextResult | BrowserGetClientWindowsResult | BrowserGetUserContextsResult | BrowserRemoveUserContextResult | BrowserSetClientWindowStateResult | BrowserSetDownloadBehaviorResult;
|
|
5
|
+
export type BrowserClientWindow = string;
|
|
6
|
+
export interface BrowserClientWindowInfo {
|
|
7
|
+
active: boolean;
|
|
8
|
+
clientWindow: BrowserClientWindow;
|
|
9
|
+
height: JsUint;
|
|
10
|
+
state: "fullscreen" | "maximized" | "minimized" | "normal";
|
|
11
|
+
width: JsUint;
|
|
12
|
+
x: JsInt;
|
|
13
|
+
y: JsInt;
|
|
14
|
+
}
|
|
15
|
+
export type BrowserUserContext = string;
|
|
16
|
+
export interface BrowserUserContextInfo {
|
|
17
|
+
userContext: BrowserUserContext;
|
|
18
|
+
}
|
|
19
|
+
export interface BrowserClose {
|
|
20
|
+
method: "browser.close";
|
|
21
|
+
params: EmptyParams;
|
|
22
|
+
}
|
|
23
|
+
export type BrowserCloseResult = EmptyResult;
|
|
24
|
+
export interface BrowserCreateUserContext {
|
|
25
|
+
method: "browser.createUserContext";
|
|
26
|
+
params: BrowserCreateUserContextParameters;
|
|
27
|
+
}
|
|
28
|
+
export interface BrowserCreateUserContextParameters {
|
|
29
|
+
acceptInsecureCerts?: boolean;
|
|
30
|
+
proxy?: SessionProxyConfiguration;
|
|
31
|
+
unhandledPromptBehavior?: SessionUserPromptHandler;
|
|
32
|
+
}
|
|
33
|
+
export type BrowserCreateUserContextResult = BrowserUserContextInfo;
|
|
34
|
+
export interface BrowserGetClientWindows {
|
|
35
|
+
method: "browser.getClientWindows";
|
|
36
|
+
params: EmptyParams;
|
|
37
|
+
}
|
|
38
|
+
export interface BrowserGetClientWindowsResult {
|
|
39
|
+
clientWindows: BrowserClientWindowInfo[];
|
|
40
|
+
}
|
|
41
|
+
export interface BrowserGetUserContexts {
|
|
42
|
+
method: "browser.getUserContexts";
|
|
43
|
+
params: EmptyParams;
|
|
44
|
+
}
|
|
45
|
+
export interface BrowserGetUserContextsResult {
|
|
46
|
+
userContexts: BrowserUserContextInfo[];
|
|
47
|
+
}
|
|
48
|
+
export interface BrowserRemoveUserContext {
|
|
49
|
+
method: "browser.removeUserContext";
|
|
50
|
+
params: BrowserRemoveUserContextParameters;
|
|
51
|
+
}
|
|
52
|
+
export interface BrowserRemoveUserContextParameters {
|
|
53
|
+
userContext: BrowserUserContext;
|
|
54
|
+
}
|
|
55
|
+
export type BrowserRemoveUserContextResult = EmptyResult;
|
|
56
|
+
export interface BrowserSetClientWindowState {
|
|
57
|
+
method: "browser.setClientWindowState";
|
|
58
|
+
params: BrowserSetClientWindowStateParameters;
|
|
59
|
+
}
|
|
60
|
+
export type BrowserSetClientWindowStateParameters = (BrowserClientWindowNamedState | BrowserClientWindowRectState) & {
|
|
61
|
+
clientWindow: BrowserClientWindow;
|
|
62
|
+
};
|
|
63
|
+
export interface BrowserClientWindowNamedState {
|
|
64
|
+
state: "fullscreen" | "maximized" | "minimized";
|
|
65
|
+
}
|
|
66
|
+
export interface BrowserClientWindowRectState {
|
|
67
|
+
state: "normal";
|
|
68
|
+
width?: JsUint;
|
|
69
|
+
height?: JsUint;
|
|
70
|
+
x?: JsInt;
|
|
71
|
+
y?: JsInt;
|
|
72
|
+
}
|
|
73
|
+
export type BrowserSetClientWindowStateResult = BrowserClientWindowInfo;
|
|
74
|
+
export interface BrowserSetDownloadBehavior {
|
|
75
|
+
method: "browser.setDownloadBehavior";
|
|
76
|
+
params: BrowserSetDownloadBehaviorParameters;
|
|
77
|
+
}
|
|
78
|
+
export interface BrowserSetDownloadBehaviorParameters {
|
|
79
|
+
downloadBehavior: BrowserDownloadBehavior | null;
|
|
80
|
+
userContexts?: BrowserUserContext[];
|
|
81
|
+
}
|
|
82
|
+
export type BrowserDownloadBehavior = (BrowserDownloadBehaviorAllowed | BrowserDownloadBehaviorDenied);
|
|
83
|
+
export interface BrowserDownloadBehaviorAllowed {
|
|
84
|
+
type: "allowed";
|
|
85
|
+
destinationFolder: string;
|
|
86
|
+
}
|
|
87
|
+
export interface BrowserDownloadBehaviorDenied {
|
|
88
|
+
type: "denied";
|
|
89
|
+
}
|
|
90
|
+
export type BrowserSetDownloadBehaviorResult = EmptyResult;
|
|
91
|
+
/** @deprecated Use {@link Browser.create} instead — will be removed in a future major version. */
|
|
92
|
+
export declare function getBrowserInstance(driver: unknown): Promise<Browser>;
|
|
93
|
+
export declare class Browser {
|
|
94
|
+
private readonly bidi;
|
|
95
|
+
private constructor();
|
|
96
|
+
static create(driver: unknown): Promise<Browser>;
|
|
97
|
+
close(): Promise<void>;
|
|
98
|
+
createUserContext(params: BrowserCreateUserContextParameters): Promise<BrowserCreateUserContextResult>;
|
|
99
|
+
getClientWindows(): Promise<BrowserGetClientWindowsResult>;
|
|
100
|
+
getUserContexts(): Promise<BrowserGetUserContextsResult>;
|
|
101
|
+
removeUserContext(params: BrowserRemoveUserContextParameters): Promise<void>;
|
|
102
|
+
setClientWindowState(params: BrowserSetClientWindowStateParameters): Promise<BrowserSetClientWindowStateResult>;
|
|
103
|
+
setDownloadBehavior(params: BrowserSetDownloadBehaviorParameters): Promise<void>;
|
|
104
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Licensed to the Software Freedom Conservancy (SFC) under one
|
|
3
|
+
// or more contributor license agreements. See the NOTICE file
|
|
4
|
+
// distributed with this work for additional information
|
|
5
|
+
// regarding copyright ownership. The SFC licenses this file
|
|
6
|
+
// to you under the Apache License, Version 2.0 (the
|
|
7
|
+
// "License"); you may not use this file except in compliance
|
|
8
|
+
// with the License. You may obtain a copy of the License at
|
|
9
|
+
//
|
|
10
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
//
|
|
12
|
+
// Unless required by applicable law or agreed to in writing,
|
|
13
|
+
// software distributed under the License is distributed on an
|
|
14
|
+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
15
|
+
// KIND, either express or implied. See the License for the
|
|
16
|
+
// specific language governing permissions and limitations
|
|
17
|
+
// under the License.
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.Browser = exports.getBrowserInstance = void 0;
|
|
20
|
+
// --- Additional Types ---
|
|
21
|
+
/** @deprecated Use {@link Browser.create} instead — will be removed in a future major version. */
|
|
22
|
+
async function getBrowserInstance(driver) {
|
|
23
|
+
return Browser.create(driver);
|
|
24
|
+
}
|
|
25
|
+
exports.getBrowserInstance = getBrowserInstance;
|
|
26
|
+
// --- Implementation ---
|
|
27
|
+
class Browser {
|
|
28
|
+
constructor(bidi) {
|
|
29
|
+
this.bidi = bidi;
|
|
30
|
+
}
|
|
31
|
+
static async create(driver) {
|
|
32
|
+
const caps = await driver.getCapabilities();
|
|
33
|
+
if (!caps.get('webSocketUrl')) {
|
|
34
|
+
throw new Error('WebDriver instance must support BiDi protocol');
|
|
35
|
+
}
|
|
36
|
+
const bidi = await driver.getBidi();
|
|
37
|
+
return new Browser(bidi);
|
|
38
|
+
}
|
|
39
|
+
async close() {
|
|
40
|
+
const response = await this.bidi.send({
|
|
41
|
+
method: 'browser.close',
|
|
42
|
+
params: {},
|
|
43
|
+
});
|
|
44
|
+
if (response['type'] === 'error') {
|
|
45
|
+
throw new Error(`${response['error']}: ${response['message']}`);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
async createUserContext(params) {
|
|
49
|
+
const response = await this.bidi.send({
|
|
50
|
+
method: 'browser.createUserContext',
|
|
51
|
+
params: params,
|
|
52
|
+
});
|
|
53
|
+
if (response['type'] === 'error') {
|
|
54
|
+
throw new Error(`${response['error']}: ${response['message']}`);
|
|
55
|
+
}
|
|
56
|
+
return response.result;
|
|
57
|
+
}
|
|
58
|
+
async getClientWindows() {
|
|
59
|
+
const response = await this.bidi.send({
|
|
60
|
+
method: 'browser.getClientWindows',
|
|
61
|
+
params: {},
|
|
62
|
+
});
|
|
63
|
+
if (response['type'] === 'error') {
|
|
64
|
+
throw new Error(`${response['error']}: ${response['message']}`);
|
|
65
|
+
}
|
|
66
|
+
return response.result;
|
|
67
|
+
}
|
|
68
|
+
async getUserContexts() {
|
|
69
|
+
const response = await this.bidi.send({
|
|
70
|
+
method: 'browser.getUserContexts',
|
|
71
|
+
params: {},
|
|
72
|
+
});
|
|
73
|
+
if (response['type'] === 'error') {
|
|
74
|
+
throw new Error(`${response['error']}: ${response['message']}`);
|
|
75
|
+
}
|
|
76
|
+
return response.result;
|
|
77
|
+
}
|
|
78
|
+
async removeUserContext(params) {
|
|
79
|
+
const response = await this.bidi.send({
|
|
80
|
+
method: 'browser.removeUserContext',
|
|
81
|
+
params: params,
|
|
82
|
+
});
|
|
83
|
+
if (response['type'] === 'error') {
|
|
84
|
+
throw new Error(`${response['error']}: ${response['message']}`);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
async setClientWindowState(params) {
|
|
88
|
+
const response = await this.bidi.send({
|
|
89
|
+
method: 'browser.setClientWindowState',
|
|
90
|
+
params: params,
|
|
91
|
+
});
|
|
92
|
+
if (response['type'] === 'error') {
|
|
93
|
+
throw new Error(`${response['error']}: ${response['message']}`);
|
|
94
|
+
}
|
|
95
|
+
return response.result;
|
|
96
|
+
}
|
|
97
|
+
async setDownloadBehavior(params) {
|
|
98
|
+
const response = await this.bidi.send({
|
|
99
|
+
method: 'browser.setDownloadBehavior',
|
|
100
|
+
params: params,
|
|
101
|
+
});
|
|
102
|
+
if (response['type'] === 'error') {
|
|
103
|
+
throw new Error(`${response['error']}: ${response['message']}`);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
exports.Browser = Browser;
|