当前位置: 首页>>代码示例>>Python>>正文


Python Wait.get_attribute方法代码示例

本文整理汇总了Python中marionette.Wait.get_attribute方法的典型用法代码示例。如果您正苦于以下问题:Python Wait.get_attribute方法的具体用法?Python Wait.get_attribute怎么用?Python Wait.get_attribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在marionette.Wait的用法示例。


在下文中一共展示了Wait.get_attribute方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from marionette import Wait [as 别名]
# 或者: from marionette.Wait import get_attribute [as 别名]
    def __init__(self, marionette):
        Base.__init__(self, marionette)

        # wait for the pop up screen to open
        view = Wait(self.marionette).until(expected.element_present(*self._iframe_locator))
        self.marionette.switch_to_frame(view)

        # wait for the page to load
        email = Wait(self.marionette).until(expected.element_present(*self._email_locator))
        Wait(self.marionette).until(lambda m: email.get_attribute("value") != "")
开发者ID:hharchani,项目名称:gaia,代码行数:12,代码来源:google.py

示例2: __init__

# 需要导入模块: from marionette import Wait [as 别名]
# 或者: from marionette.Wait import get_attribute [as 别名]
    def __init__(self, marionette):
        Base.__init__(self, marionette)
        self.marionette.switch_to_frame()

        # wait for the pop up screen to open
        view = Wait(self.marionette, timeout=60).until(
            expected.element_present(*self._iframe_locator))
        Wait(self.marionette).until(expected.element_displayed(view))

        # Change the app to make use of the Facebook developer appId
        Wait(self.marionette, timeout=60).until(lambda m: view.get_attribute('data-url') != 'about:blank')

        # Desktop b2g uses this
        str = view.get_attribute('data-url').replace('123456', '323630664378726')
        # Device uses this
        str = str.replace('395559767228801', '323630664378726')

        self.marionette.switch_to_frame(view)
        # Wait until the original page has loaded a bit, because sometimes,
        # trying to load the 2nd page directly after the first, causes a blank page
        Wait(self.marionette, timeout=60).until(expected.element_present(*self._div_locator))
        self.marionette.navigate(str)
        Wait(self.marionette, timeout=60).until(expected.element_present(*self._email_locator))
开发者ID:bebef1987,项目名称:gaia,代码行数:25,代码来源:facebook.py

示例3: enter_email

# 需要导入模块: from marionette import Wait [as 别名]
# 或者: from marionette.Wait import get_attribute [as 别名]
    def enter_email(self, email=None):
        self.marionette.switch_to_frame()
        iframe = Wait(self.marionette, timeout=60).until(
            expected.element_present(*self._iframe_locator))
        Wait(self.marionette).until(expected.element_displayed(iframe))
        Wait(self.marionette, timeout=60).until(lambda m: iframe.get_attribute('data-url') != 'about:blank')
        self.marionette.switch_to_frame(iframe)

        input = Wait(self.marionette, timeout=60).until(
            expected.element_present(*self._input_locator))
        Wait(self.marionette).until(expected.element_displayed(input))
        input.send_keys(email)

        # Wait until the keyboard is completely displayed, otherwise tapping
        # the next button is unreliable
        self.marionette.switch_to_frame()
        Wait(self.marionette).until(lambda m: self.keyboard.is_keyboard_displayed)
        self.marionette.switch_to_frame(iframe)

        self.marionette.find_element(*self._next_locator).tap()
开发者ID:AutomatedTester,项目名称:gaia,代码行数:22,代码来源:fxaccounts.py

示例4: wallpaper_preview_src

# 需要导入模块: from marionette import Wait [as 别名]
# 或者: from marionette.Wait import get_attribute [as 别名]
 def wallpaper_preview_src(self):
     element = Wait(self.marionette).until(
         expected.element_present(*self._wallpaper_preview_locator))
     Wait(self.marionette).until(expected.element_displayed(element))
     return element.get_attribute('src')
开发者ID:William-Hsu,项目名称:gaia,代码行数:7,代码来源:display.py

示例5: HTML5Player

# 需要导入模块: from marionette import Wait [as 别名]
# 或者: from marionette.Wait import get_attribute [as 别名]
class HTML5Player(PageRegion):
    """Represents HTML5 Player.

    Reference:
    http://www.w3.org/TR/2012/WD-html5-20121025/media-elements.html#media-element
    """

    _video_element_locator = (By.TAG_NAME, 'video')

    def __init__(self, marionette):
        Base.__init__(self, marionette)
        self.root_element = Wait(self.marionette).until(
            expected.element_present(*self._video_element_locator))
        Wait(self.marionette).until(expected.element_displayed(self.root_element))

    def wait_for_video_loaded(self):
        # Wait long enough to make sure enough of the video has been loaded
        Wait(self.marionette, timeout=60).until(
            lambda m: int(self.root_element.get_attribute('readyState')) == 4)

    @property
    def is_fullscreen(self):
        return self.marionette.execute_script("""return document.mozFullScreenElement ==
                                                 document.getElementsByTagName("video")[0]""")

    @property
    def is_playing(self):
        return self.root_element.get_attribute('paused') != 'true'

    @property
    def is_muted(self):
        return self.root_element.get_attribute('muted') == 'true'

    @property
    def is_ended(self):
        return self.root_element.get_attribute('ended') == 'true'

    @property
    def controls_visible(self):
        return (int(self.get_location('playButton')[0]) > 0)

    def invoke_controls(self):
        Wait(self.marionette).until(lambda m: self.controls_visible is False)
        self.root_element.tap()
        Wait(self.marionette).until(lambda m: self.controls_visible)

    def show_controls(self):
        Wait(self.marionette).until(lambda m: self.controls_visible is False)
        self.marionette.execute_script("""
           var a = SpecialPowers.Cc["@mozilla.org/inspector/dom-utils;1"]
               .getService(SpecialPowers.Ci.inIDOMUtils)
               .getChildrenForNode(document.getElementsByTagName('video')[0], true);
           var x = a[1].ownerDocument.getAnonymousElementByAttribute(a[1],'class', 'controlBar');
           x.removeAttribute('hidden');
         """)
        Wait(self.marionette).until(lambda m: self.controls_visible)

    def get_location(self, class_name):
        return self.marionette.execute_script("""
           var a = SpecialPowers.Cc["@mozilla.org/inspector/dom-utils;1"]
               .getService(SpecialPowers.Ci.inIDOMUtils)
               .getChildrenForNode(document.getElementsByTagName('video')[0], true);
           var x1 = document.getElementsByTagName('video')[0].getBoundingClientRect().left;
           var x2 = a[1].ownerDocument
                        .getAnonymousElementByAttribute(a[1],'class', '%s')
                        .getBoundingClientRect().left;
           var y1 = document.getElementsByTagName('video')[0]
                            .getBoundingClientRect().top;
           var y2 = a[1].ownerDocument.getAnonymousElementByAttribute(a[1],'class', '%s')
                        .getBoundingClientRect().top;
           return (Math.floor(x2-x1) + ',' + Math.floor(y2-y1));
         """ % (class_name, class_name)).split(',')

    def tap_video_control(self, class_name):
        location = self.get_location(class_name)
        if location[0] <= 0 or location[1] <= 0:
            print 'x=%d, y=%d' % (location[0], location[1])
            self.assertTrue(False)
        self.root_element.tap(x=int(location[0])+5, y=int(location[1])+5)

    def tap_play(self):
        self.tap_video_control('playButton')
        Wait(self.marionette).until(lambda m: self.is_playing is True)
        # Tapping the play button makes the controls disappear, wait for that to happen
        Wait(self.marionette).until(lambda m: self.controls_visible is False)

    def tap_pause(self):
        self.tap_video_control('playButton')
        Wait(self.marionette).until(lambda m: self.is_playing is False)

    def tap_mute(self):
        self.tap_video_control('muteButton')
        Wait(self.marionette).until(lambda m: self.is_muted is True)

    def tap_unmute(self):
        self.tap_video_control('muteButton')
        Wait(self.marionette).until(lambda m: self.is_muted is False)

    def tap_full_screen(self):
        self.tap_video_control('fullscreenButton')
#.........这里部分代码省略.........
开发者ID:AlexSJ,项目名称:gaia,代码行数:103,代码来源:html5_player.py

示例6: tap_portrait_crop

# 需要导入模块: from marionette import Wait [as 别名]
# 或者: from marionette.Wait import get_attribute [as 别名]
 def tap_portrait_crop(self):
     element = Wait(self.marionette).until(expected.element_present(*self._crop_portrait_locator))
     Wait(self.marionette).until(expected.element_displayed(element))
     element.tap()
     Wait(self.marionette).until(lambda m: "selected" in element.get_attribute("class"))
开发者ID:hharchani,项目名称:gaia,代码行数:7,代码来源:edit_photo.py

示例7: wait_for_radio_off

# 需要导入模块: from marionette import Wait [as 别名]
# 或者: from marionette.Wait import get_attribute [as 别名]
 def wait_for_radio_off(self):
     power = Wait(self.marionette).until(
         expected.element_present(*self._power_button_locator))
     Wait(self.marionette).until(
         lambda m: not power.get_attribute('data-enabled') == 'true')
开发者ID:bebef1987,项目名称:gaia,代码行数:7,代码来源:app.py

示例8: launch

# 需要导入模块: from marionette import Wait [as 别名]
# 或者: from marionette.Wait import get_attribute [as 别名]
 def launch(self, airplane_mode=False):
     Base.launch(self)
     power = Wait(self.marionette).until(
         expected.element_present(*self._power_button_locator))
     if not airplane_mode:
         Wait(self.marionette).until(lambda m: power.get_attribute('data-enabled') == 'true')
开发者ID:bebef1987,项目名称:gaia,代码行数:8,代码来源:app.py


注:本文中的marionette.Wait.get_attribute方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。