// 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.1617goog.provide('webdriver.Session');1819goog.require('webdriver.Capabilities');20212223/**24* Contains information about a WebDriver session.25* @param {string} id The session ID.26* @param {!(Object|webdriver.Capabilities)} capabilities The session27* capabilities.28* @constructor29*/30webdriver.Session = function(id, capabilities) {3132/** @private {string} */33this.id_ = id;3435/** @private {!webdriver.Capabilities} */36this.caps_ = new webdriver.Capabilities().merge(capabilities);37};383940/**41* @return {string} This session's ID.42*/43webdriver.Session.prototype.getId = function() {44return this.id_;45};464748/**49* @return {!webdriver.Capabilities} This session's capabilities.50*/51webdriver.Session.prototype.getCapabilities = function() {52return this.caps_;53};545556/**57* Retrieves the value of a specific capability.58* @param {string} key The capability to retrieve.59* @return {*} The capability value.60*/61webdriver.Session.prototype.getCapability = function(key) {62return this.caps_.get(key);63};646566/**67* Returns the JSON representation of this object, which is just the string68* session ID.69* @return {string} The JSON representation of this Session.70*/71webdriver.Session.prototype.toJSON = function() {72return this.getId();73};747576