lib/commands/webdriver/page.js

Maintainability

57.10

Lines of code

74

Created with Raphaël 2.1.002550751002014-3-30

2014-3-30
Maintainability: 57.1

Created with Raphaël 2.1.00204060802014-3-30

2014-3-30
Lines of Code: 74

Difficulty

5.88

Estimated Errors

0.13

Function weight

By Complexity

Created with Raphaël 2.1.0module.exports1

By SLOC

Created with Raphaël 2.1.0module.exports63
1
/*!
2
 *
3
 * Copyright (c) 2013 Sebastian Golasch
4
 *
5
 * Permission is hereby granted, free of charge, to any person obtaining a
6
 * copy of this software and associated documentation files (the "Software"),
7
 * to deal in the Software without restriction, including without limitation
8
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9
 * and/or sell copies of the Software, and to permit persons to whom the
10
 * Software is furnished to do so, subject to the following conditions:
11
 *
12
 * The above copyright notice and this permission notice shall be included
13
 * in all copies or substantial portions of the Software.
14
 *
15
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
16
 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
 * DEALINGS IN THE SOFTWARE.
22
 *
23
 */
24
 
25
'use strict';
26
 
27
/**
28
 * Page related WebDriver endpoints
29
 * see [JsonWireProtocol](https://code.google.com/p/selenium/wiki/JsonWireProtocol)
30
 *
31
 * @module FirefoxDriver
32
 * @class Page
33
 * @namespace FirefoxDriver.Commands.WebDriver
34
 */
35
 
36
module.exports = function (Driver) {
37
 
38
  /**
39
   * Get the current page source
40
   *
41
   * @method source
42
   * @see https://code.google.com/p/selenium/wiki/JsonWireProtocol#GET_/session/:sessionId/title
43
   * @param {GET} sessionId ID of the session to route the command to
44
   */
45
 
46
  Driver.addCommand({
47
    name: 'source',
48
    url: '/session/:sessionId/source',
49
    method: 'get'
50
  });
51
 
52
  /**
53
   * Get the current page title
54
   *
55
   * @method title
56
   * @see https://code.google.com/p/selenium/wiki/JsonWireProtocol#GET_/session/:sessionId/title
57
   * @param {GET} sessionId ID of the session to route the command to
58
   */
59
 
60
  Driver.addCommand({
61
    name: 'title',
62
    url: '/session/:sessionId/title',
63
    method: 'get'
64
  });
65
 
66
  /**
67
   * Get the current geo location
68
   *
69
   * @method geoLocation
70
   * @see https://code.google.com/p/selenium/wiki/JsonWireProtocol#GET_/session/:sessionId/location
71
   * @param {GET} sessionId ID of the session to route the command to
72
   */
73
 
74
  Driver.addCommand({
75
    name: 'geoLocation',
76
    url: '/session/:sessionId/location',
77
    method: 'get'
78
  });
79
 
80
  /**
81
   * Set the geo location
82
   *
83
   * @method setGeoLocation
84
   * @see https://code.google.com/p/selenium/wiki/JsonWireProtocol#POST_/session/:sessionId/location
85
   * @param {GET} sessionId ID of the session to route the command to
86
   * @param {POST} latitude The new location
87
   * @param {POST} longitude The new location
88
   * @param {POST} altitude The new location
89
   */
90
 
91
  Driver.addCommand({
92
    name: 'location',
93
    url: '/session/:sessionId/location',
94
    method: 'post',
95
    params: {latitude: 'latitude', longitude: 'longitude', altitude: 'altitude'}
96
  });
97
 
98
};