* Describes a set of capabilities for a WebDriver session.
| 232 | * Describes a set of capabilities for a WebDriver session. |
| 233 | */ |
| 234 | class Capabilities { |
| 235 | /** |
| 236 | * @param {(Capabilities|Map<string, ?>|Object)=} other Another set of |
| 237 | * capabilities to initialize this instance from. |
| 238 | */ |
| 239 | constructor(other = undefined) { |
| 240 | if (other instanceof Capabilities) { |
| 241 | other = other.map_ |
| 242 | } else if (other && !(other instanceof Map)) { |
| 243 | other = toMap(other) |
| 244 | } |
| 245 | /** @private @const {!Map<string, ?>} */ |
| 246 | this.map_ = new Map(other) |
| 247 | } |
| 248 | |
| 249 | /** @return {number} The number of capabilities set. */ |
| 250 | get size() { |
| 251 | return this.map_.size |
| 252 | } |
| 253 | |
| 254 | /** |
| 255 | * @return {!Capabilities} A basic set of capabilities for Chrome. |
| 256 | */ |
| 257 | static chrome() { |
| 258 | return new Capabilities().setBrowserName(Browser.CHROME) |
| 259 | } |
| 260 | |
| 261 | /** |
| 262 | * @return {!Capabilities} A basic set of capabilities for Microsoft Edge. |
| 263 | */ |
| 264 | static edge() { |
| 265 | return new Capabilities().setBrowserName(Browser.EDGE) |
| 266 | } |
| 267 | |
| 268 | /** |
| 269 | * @return {!Capabilities} A basic set of capabilities for Firefox. |
| 270 | */ |
| 271 | static firefox() { |
| 272 | return new Capabilities().setBrowserName(Browser.FIREFOX).set('moz:debuggerAddress', true) |
| 273 | } |
| 274 | |
| 275 | /** |
| 276 | * @return {!Capabilities} A basic set of capabilities for Internet Explorer. |
| 277 | */ |
| 278 | static ie() { |
| 279 | return new Capabilities().setBrowserName(Browser.INTERNET_EXPLORER) |
| 280 | } |
| 281 | |
| 282 | /** |
| 283 | * @return {!Capabilities} A basic set of capabilities for Safari. |
| 284 | */ |
| 285 | static safari() { |
| 286 | return new Capabilities().setBrowserName(Browser.SAFARI) |
| 287 | } |
| 288 | |
| 289 | /** |
| 290 | * @return {!Object<string, ?>} The JSON representation of this instance. |
| 291 | * Note, the returned object may contain nested promised values. |
nothing calls this directly
no outgoing calls
no test coverage detected