예제 #1
0
 def __init__(self):
     self.path = '/cloud/project/'
     self.title = CreateElement.create(None,None,None,Wait_By.TITLE_IS,'云主机概况 - 百悟云')
     self.menu_network = CreateElement.create(By.CSS_SELECTOR, '.side_network', '网络',Wait_By.PRESENCE_OF_ELEMENT_LOCATED)
     self.menu_network_secgroup = CreateElement.create(By.LINK_TEXT,'安全组','安全组',Wait_By.PRESENCE_OF_ELEMENT_LOCATED)
     self.user = CreateElement.create(By.CSS_SELECTOR,'li.dropdown:nth-child(2) > a:nth-child(1)',None,Wait_By.PRESENCE_OF_ELEMENT_LOCATED)
     self.user_logout = CreateElement.create(By.CSS_SELECTOR,'#editor_list > li:nth-child(4) > a:nth-child(1)','退出',Wait_By.PRESENCE_OF_ELEMENT_LOCATED)
예제 #2
0
    def __init__(self):
        self.path = '/cloud/auth/login/?next=/cloud/'
        self.title = CreateElement.create(None, None, None, Wait_By.TITLE_IS,
                                          '登录 - 百悟云')
        self.usernameInput = CreateElement.create(
            By.ID, 'id_username', None, Wait_By.PRESENCE_OF_ELEMENT_LOCATED)
        self.passwordInput = CreateElement.create(
            By.ID, 'id_password', None, Wait_By.PRESENCE_OF_ELEMENT_LOCATED)
        self.loginBtn = CreateElement.create(
            By.ID, 'loginBtn', None, Wait_By.PRESENCE_OF_ELEMENT_LOCATED)

        self.loginWrongUsernameAndPassword_tip = CreateElement.create(
            By.CSS_SELECTOR, 'div.alert:nth-child(3) > p:nth-child(1)',
            '用户名或密码不正确', None, Wait_By.PRESENCE_OF_ELEMENT_LOCATED)
        self.loginEmptyUsername_tip = CreateElement.create(
            By.CSS_SELECTOR, '.help-block', '这个字段是必填项。', None,
            Wait_By.PRESENCE_OF_ELEMENT_LOCATED)
        self.loginEmptyPassword_tip = CreateElement.create(
            By.CSS_SELECTOR, '.help-block', '这个字段是必填项。', None,
            Wait_By.PRESENCE_OF_ELEMENT_LOCATED)
        self.loginEmptyUsernameAndPassword_username_tip = CreateElement.create(
            By.CSS_SELECTOR, 'div.form-group:nth-child(4) > span:nth-child(4)',
            '这个字段是必填项。', None, Wait_By.PRESENCE_OF_ELEMENT_LOCATED)
        self.loginEmptyUsernameAndPassword_password_tip = CreateElement.create(
            By.CSS_SELECTOR, 'div.form-group:nth-child(7) > span:nth-child(4)',
            '这个字段是必填项。', None, Wait_By.PRESENCE_OF_ELEMENT_LOCATED)
예제 #3
0
 def __init__(self):
     self.start_btn = CreateElement.create(Locator_Type.ID,
                                           'com.moji.mjweather:id/zc',
                                           wait_type=Wait_By.VISIBILITY_OF)
     self.search_city = CreateElement.create(
         Locator_Type.ID,
         'com.moji.mjweather:id/d',
         wait_type=Wait_By.VISIBILITY_OF)
     self.city_btns = CreateElement.create(Locator_Type.ID,
                                           'com.moji.mjweather:id/abk',
                                           wait_type=Wait_By.VISIBILITY_OF)
예제 #4
0
 def __init__(self):
     self.path = '/'
     self.title = CreateElement.create(None, None, None, Wait_By.TITLE_IS)
     self.search_input = CreateElement.create(
         Locator_Type.ID,
         'kw',
         wait_type=Wait_By.PRESENCE_OF_ELEMENT_LOCATED)
     self.search_button = CreateElement.create(
         Locator_Type.ID,
         'su',
         wait_type=Wait_By.PRESENCE_OF_ELEMENT_LOCATED)
예제 #5
0
 def is_toast_visible(self,
                      text,
                      platformName='android',
                      automationName='UiAutomator2',
                      isRegexp=False):
     """
     仅支持Android
     :param text:
     :param platformName: android、ios
     :param automationName: 支持UiAutomator2、Espresso
     :param isRegexp: 仅当automaitionName为Espresso时有效
     :return:
     """
     if not text:
         return False
     if 'android' == platformName.lower():
         if 'uiautomator2' == automationName.lower():
             toast_element = CreateElement.create(
                 Locator_Type.XPATH,
                 ".//*[contains(@text,'%s')]" % text,
                 None,
                 Wait_By.PRESENCE_OF_ELEMENT_LOCATED,
                 wait_seconds=5)
             try:
                 self.getElement(toast_element)
                 return True
             except:
                 return False
         elif 'espresso' == platformName.lower():
             script_arg = {'text': text}
             if isRegexp:
                 script_arg.update({'isRegexp': True})
             script = 'mobile:isToastVisible'
             return self._driver.execute_script(script, script_arg)
     elif 'ios' == platformName.lower():
         return False
예제 #6
0
 def __init__(self):
     self.title = CreateElement.create(None, None, None, Wait_By.TITLE_IS,
                                       '安全组 - 百悟云')
     self.search = CreateElement.create(By.NAME,
                                        'security_groups__filter__q', '筛选',
                                        Wait_By.PRESENCE_OF_ELEMENT_LOCATED)