def login(self):
        """
        登录多屏控制端的具体方法

        :return: 无返回值
        """
        count = 0
        while count < 9999:
            try:
                self.driver.get(self.url)
                logger.debug('打开主页,进入登录页')
                self.driver.maximize_window()
                logger.debug('最大化窗口')
                input_text(self.driver, self.username_xpath, self.username)
                logger.debug('在登录页输入用户名')
                input_text(self.driver, self.password_xpath, self.password)
                logger.debug('在登录页输入密码')
                click_element(self.driver, self.login_btn_xpath)
                logger.debug('点击登陆按钮')
                start_title_elem = wait_for_find_element(
                    self.driver, self.start_title_xpath)
                logger.debug('断言 start_title_elem.text({}) == 文稿预览'.format(
                    start_title_elem.text))
                assert start_title_elem.text.strip() == '文稿预览'
                logger.debug('登陆成功')
                break
            except TimeoutException as timeout:
                count += 1
                err_msg = '登录超时: {},准备进行第{}次重试 '.format(timeout, count)
                logger.error(err_msg)
                self.screen_shot()
            except AssertionError as err:
                count += 1
                err_msg = '断言出错: {},当前页面下没有“文稿预览”元素 '.format(err)
                logger.error(err_msg)
                self.screen_shot()
            except Exception as e:
                count += 1
                logger.error("发生未知的异常:{},准备进行重试".format(e))

        if count >= 9999:
            logger.fatal('登陆重试{}次, 退出程序!!!'.format(count))
            self.screen_shot()
            raise Exception('重试了 {} 次登陆都失败了,抛出异常!!!'.format(count))
Exemple #2
0
        input_list.remove('')

    input_list.reverse()
    if razdelitel == '.':
        razdelitel = '. '

    print razdelitel.join(input_list),
    input_list.reverse()
    return input_list



from utils import input_text

if __name__ == "__main__":
    in_text = input_text()
    sentence = razdel(in_text,'.')
    print
    print
    word = []
    for i in sentence:
        word.append(razdel(i,' '))
        print'. ',
    print
    print

    for words in word:
        for i in words:
            razdel(i,'')
            #print ' ',
        print '. ',
Exemple #3
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
def count_glasnie(word):

    low_word = word.lower()
    count = 0
    for i in low_word:
        if i in "aeiouy":
            count += 1
    return count


from utils import input_text

if __name__ == "__main__":

    in_text = input_text()
    input_list = in_text.split(' ')
    max_glassnie = 0
    for i in input_list:
        temp_counter = count_glasnie(i)
        if temp_counter > max_glassnie:
            max_glassnie = temp_counter

    print 'Maximum number of vowels:', max_glassnie
Exemple #4
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-




from utils import input_text, consonants

if __name__ == "__main__":
    in_text = list(input_text())
    counter = 0
    for i in range(1, len(in_text) - 1):
        if in_text[i] == 'a':
            if in_text[i-1] in consonants() and in_text[i+1] in consonants():
                counter += 1
    print counter


# та же проблема, что и в 3-м - необходимо сделать все манипуляции