Path: blob/trunk/javascript/selenium-webdriver/bidi/clientWindowInfo.js
2884 views
// Licensed to the Software Freedom Conservancy (SFC) under one1// or more contributor license agreements. See the NOTICE file2// distributed with this work for additional information3// regarding copyright ownership. The SFC licenses this file4// to you under the Apache License, Version 2.0 (the5// "License"); you may not use this file except in compliance6// with the License. You may obtain a copy of the License at7//8// http://www.apache.org/licenses/LICENSE-2.09//10// Unless required by applicable law or agreed to in writing,11// software distributed under the License is distributed on an12// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY13// KIND, either express or implied. See the License for the14// specific language governing permissions and limitations15// under the License.1617const WindowState = Object.freeze({18FULLSCREEN: 'fullscreen',19MAXIMIZED: 'maximized',20MINIMIZED: 'minimized',21NORMAL: 'normal',22})2324class ClientWindowInfo {25/**26* @param {Object} params Window information parameters27* @param {string} params.clientWindow Window identifier28* @param {string} params.state Window state from WindowState29* @param {number} params.width Window width30* @param {number} params.height Window height31* @param {number} params.x Window x coordinate32* @param {number} params.y Window y coordinate33* @param {boolean} params.active Whether window is active and can receive keyboard input34*/35constructor({ clientWindow, state, width, height, x, y, active }) {36this.clientWindow = clientWindow37this.state = state38this.width = width39this.height = height40this.x = x41this.y = y42this.active = active43}4445static fromJson(json) {46return new ClientWindowInfo({47...json,48state: json.state.toLowerCase(),49})50}51}5253module.exports = { WindowState, ClientWindowInfo }545556