summaryrefslogtreecommitdiffstats
path: root/testing/marionette/puppeteer/firefox/firefox_puppeteer/puppeteer.py
blob: 1894a414b8a04bb0ca7d44ebd8bd26e2425bcca2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.

from decorators import use_class_as_property


class Puppeteer(object):
    """The puppeteer class is used to expose additional API and UI libraries.

    Each library can be referenced by its puppeteer name as a member of a
    Puppeteer instance. For example, the `current_window` member of the
    `Browser` class can be accessed via `puppeteer.browser.current_window`.
    """

    def __init__(self, marionette):
        self._marionette = marionette

    @property
    def marionette(self):
        return self._marionette

    @use_class_as_property('api.appinfo.AppInfo')
    def appinfo(self):
        """
        Provides access to members of the appinfo  api.

        See the :class:`~api.appinfo.AppInfo` reference.
        """

    @use_class_as_property('api.keys.Keys')
    def keys(self):
        """
        Provides a definition of control keys to use with keyboard shortcuts.
        For example, keys.CONTROL or keys.ALT.
        See the :class:`~api.keys.Keys` reference.
        """

    @use_class_as_property('api.places.Places')
    def places(self):
        """Provides low-level access to several bookmark and history related actions.

        See the :class:`~api.places.Places` reference.
        """

    @use_class_as_property('api.utils.Utils')
    def utils(self):
        """Provides an api for interacting with utility actions.

        See the :class:`~api.utils.Utils` reference.
        """

    @property
    def platform(self):
        """Returns the lowercased platform name.

        :returns: Platform name
        """
        return self.marionette.session_capabilities['platformName']

    @use_class_as_property('api.prefs.Preferences')
    def prefs(self):
        """
        Provides an api for setting and inspecting preferences, as see in
        about:config.

        See the :class:`~api.prefs.Preferences` reference.
        """

    @use_class_as_property('api.security.Security')
    def security(self):
        """
        Provides an api for accessing security related properties and helpers.

        See the :class:`~api.security.Security` reference.
        """

    @use_class_as_property('ui.windows.Windows')
    def windows(self):
        """
        Provides shortcuts to the top-level windows.

        See the :class:`~ui.window.Windows` reference.
        """