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


Python BuiltIn.reload_page_until_element_displayed方法代码示例

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


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

示例1: Inbox

# 需要导入模块: from robot.libraries.BuiltIn import BuiltIn [as 别名]
# 或者: from robot.libraries.BuiltIn.BuiltIn import reload_page_until_element_displayed [as 别名]

#.........这里部分代码省略.........
    def open_email_by_subject(self, subject):
        locator = self.elements['mail_table']

        email_table = self._selenium2Library.element_find(locator, True, False, None)
        # Find the checkbox which subject is match with the given subject
        xpath_locator = ".//span[normalize-space(@title)='" + subject + "']"
        _element = email_table.find_element(By.XPATH, xpath_locator)
        _element.click()
        self._selenium2Library.wait_until_page_load(self._selenium2Library.timeout)

    '''
    Usage: Select the email by pre-define category
    Params:
        category: All, None, Read, Unread, Starred, Unstarred
    '''
    def select_email_by_category(self, category):
        self._selenium2Library.click_element(self.elements['btn_popup_category'])
        xpath_locator = "xpath=//div[@id='menu-ml-cbox']//span[text()='" + category + "']"
        self._selenium2Library.wait_until_element_is_visible(xpath_locator,
                                                             self._selenium2Library.timeout)
        button = self._selenium2Library.element_find(xpath_locator, True, False, None)
        button.click()

        '''
    Usage: Select the email by pre-define category
    Params:
        category: All, None, Read, Unread, Starred, Unstarred
    '''

    '''
    Usage: Click to compose an email
    Params:

    '''
    def compose_email(self):
        self._selenium2Library.click_element(self.elements['btn_compose'])
        self._selenium2Library.wait_until_element_is_visible(self.elements['txt_to_field'])

    '''
    Usage: Add recipient
    Params:
        to: list of to recipients, separated by ;
        cc: list of cc recipients, separeted by ;
        bcc: list of bcc recipients, separated by ;
    '''
    def _input_recipient(self, locator, text):
        for item in text.split(";"):
            input_text = item.split("|")
            if len(input_text)==1:
                self._selenium2Library.input_text(locator, input_text, False)
                self._selenium2Library.input_text(locator, Keys.TAB, False)
            else:
                self._selenium2Library.input_text(locator, input_text[0], False)
                text_holder = "xpath=//div[contains(.,'" + input_text[1] +"')]"
                self._selenium2Library.wait_until_element_is_displayed(text_holder, self._selenium2Library.timeout)
                #self._selenium2Library.delay(1)
                self._selenium2Library.click_element(text_holder)

    def add_recipients(self, to=None, cc=None, bcc=None):
        list_fields = [to, cc, bcc]
        list_locators = [self.elements['txt_to_field'], self.elements['txt_cc_field'], self.elements['txt_bcc_field']]
        for i in range(len(list_fields)):
            if list_fields[i]:
                self._input_recipient(list_locators[i], list_fields[i])

    def add_content(self, subject, body, override=True):
        if subject:
            self._selenium2Library.input_text(self.elements['txt_subject_field'], subject, override)
        if body:
            self._selenium2Library.input_text(self.elements['txt_body_field'], body, override)

    '''
    Usage: Click Send button to send email
    Params:
    '''
    def send_email(self):
        self._selenium2Library.click_element(self.elements['btn_send'])

    def verify_email_content(self, from_recipient=None, content=None):
        if from_recipient:
            self._selenium2Library.element_text_should_be(self.elements['lbl_from'], from_recipient.strip())
        if content:
            self._selenium2Library.element_text_should_be(self.elements['txt_mail_content'], content.strip())

    '''
    Usage: Delete the selected email
    '''
    def delete_selected_email(self):
        self._selenium2Library.click_element(self.elements['btn_delete'])

        '''
    Usage: Open email by subject
    '''
    def refresh_page_until_email_by_subject_exist(self, subject, timeout):
        # locator = self.elements['mail_table']
        # email_table = self._selenium2Library.element_find(locator, True, False, None)
        # Find the checkbox which subject is match with the given subject
        logger.info(subject, True, True)
        xpath_property = "xpath=//span[normalize-space(@title)='" + subject + "']"
        self._selenium2Library.reload_page_until_element_displayed(xpath_property, timeout)
开发者ID:vumvo,项目名称:MyFirstGitHub,代码行数:104,代码来源:Inbox.py


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