Esempio n. 1
0
def step_impl_open_login_page(context):
    """
    :type context: behave.runner.Context
    """
    context.driver = Driver()
    context.loginpage = LoginPage(context.driver)
    context.loginpage.load_login_page()
    context.loginpage.verify_on_login_page()
Esempio n. 2
0
def step_impl_validate_logged_in(context):
    """
    :type context: behave.runner.Context
    """
    driver = Driver()
    loginpage = LoginPage(driver)
    driver = loginpage.log_in()
    context.adsdesignpage = AdDesignPage(driver)
Esempio n. 3
0
 def setUp(self):
     self.driver = Driver()
     self.driver.navigate(inputs.base_url)
     login_page = Login(self.driver)
     login_page.accept_cookies()
     login_page.enter_username(inputs.login_username)
     login_page.enter_password(inputs.login_password)
     login_page.click_submit()
Esempio n. 4
0
def step_impl(context):
    """
    :type context: behave.runner.Context
    """
    driver = Driver()
    loginpage = LoginPage(driver)
    driver = loginpage.log_in()
    context.adsdesignpage = AdDesignPage(driver)
    context.adsdesignpage.click_menu()
    context.adsdesignpage.verify_on_ad_design_page()
Esempio n. 5
0
def step_impl(context):
    """
    :type context: behave.runner.Context
    """
    is_headless = context.config.userdata.get("headless", None)
    driver = Driver(is_headless)
    loginpage = LoginPage(driver)
    driver = loginpage.log_in()
    context.navmenu = NavigationMenu(driver)
    context.adsdesignpage = AdDesignPage(driver)
    context.navmenu.navigate_to_page("Ad Designs")
    context.adsdesignpage.verify_on_ad_design_page()
Esempio n. 6
0
def step_impl(context):
    """
    :type context: behave.runner.Context
    """
    is_headless = context.config.userdata.get("headless", None)
    driver = Driver(is_headless)
    loginpage = LoginPage(driver)
    driver = loginpage.log_in()
    context.navmenu = NavigationMenu(driver)
    context.audiencepage = AudiencePage(driver)
    context.navmenu.navigate_to_page("Audience")
    context.audiencepage.verify_on_audiences_page()
    context.audiencepage.verify_audiences_page_is_paginated()
Esempio n. 7
0
def step_impl(context, screen_name):
    """
    :type screen_name: str
    :type context: behave.runner.Context
    """
    driver = Driver()
    loginpage = LoginPage(driver)
    driver = loginpage.log_in()
    context.adsdesignpage = AdDesignPage(driver)
    context.adsdesignpage.click_menu()
    context.adsdesignpage.verify_on_ad_design_page()
    context.adsdesignpage.click_create_ad_design_button()
    context.adsdesignpage.click_box("pagePostAd")
    context.adsdesignpage.click_btn("Next")
    context.adsdesignpage.screen_is_displayed(screen_name)
Esempio n. 8
0
def step_impl(context, adtype_id):
    """
    :type adtype_id: str
    :type context: behave.runner.Context
    """
    is_headless = context.config.userdata.get("headless", None)
    driver = Driver(is_headless)
    loginpage = LoginPage(driver)
    driver = loginpage.log_in()
    context.navmenu = NavigationMenu(driver)
    context.adsdesignpage = AdDesignPage(driver)
    context.navmenu.navigate_to_page("Ad Designs")
    context.adsdesignpage.verify_on_ad_design_page()
    context.adsdesignpage.click_create_ad_design_button()
    if adtype_id == 'leadAd':
        context.adsdesignpage.select_page('Test page')
    context.adsdesignpage.click_box(adtype_id)
    context.adsdesignpage.click_btn("Next")
    context.ad_type = adtype_id + "Type"
    context.adsdesignpage.screen_is_displayed(context.ad_type)
    context.popup_window = PopUpWindow(driver)
    context.design_count = context.adsdesignpage._get_design_count()
Esempio n. 9
0
 def setUp(self):
     self.driver = Driver()
     self.driver.get(strings.Urls.editor_url)
     self.driver.add_cookie(
         strings.Cookies.editor_test_blog_password_cookie)
Esempio n. 10
0
import os
from webdriver import Driver
import logging

logging.basicConfig(filename='logs',
                    level=logging.INFO,
                    format='%(asctime)s - %(levelname)s - %(message)s')
driver = Driver.Driver('D:\Downloads\Chrome', True).driver


class AnimesVisionBot:
    def list_animes(self):
        print('.: Downaload no Animes Vision :.')
        print('Digite o termo para a pesquisa')
        while True:
            try:
                print('>>', end=' ')
                key = str(input())
                break
            except:
                print('<< Invalido')
                continue
        logging.info('Pesquisando ' + key)
        try:
            driver.get('https://animesvision.biz/search?query=' + key)
            animes = driver.find_elements_by_class_name('thumb')
            if len(animes) == 0:
                print('Nenhum resultado para a sua busca :(')
        except:
            logging.info('Elemnto não encontrado')
        return animes
Esempio n. 11
0
 def setUp(self):
     self.driver = Driver()
     self.driver.instance.maximize_window()
     self.driver.navigate(strings.base_url)
Esempio n. 12
0
    f.close()


def deEmojify(text):
    regrex_pattern = re.compile(
        pattern="["
        u"\U0001F600-\U0001F64F"  # emoticons
        u"\U0001F300-\U0001F5FF"  # symbols & pictographs
        u"\U0001F680-\U0001F6FF"  # transport & map symbols
        u"\U0001F1E0-\U0001F1FF"  # flags (iOS)
        "]+",
        flags=re.UNICODE)
    return regrex_pattern.sub(r'', text)


driver = Driver(headless=True)
driver.setAutoClose()
url = "https://www.cnblogs.com/"
smsLoginUrl = "https://account.cnblogs.com/signin?returnUrl=https:%2F%2Fwww.cnblogs.com%2F#sms"
driver.open_browser(smsLoginUrl)
# phoneEle = driver.browser.find_element_by_id("mat-input-1")
# phoneEle.send_keys("18316629973")
# driver.click_element('//*[@id="mat-tab-content-0-1"]/div/div/app-verification-code-input/mat-form-field/div/div[1]/div[4]/button/span[1]')
#手动登录
time.sleep(35)

# #点击编辑
driver.click_element('//*[@id="navbar_login_status"]/a[2]')
workDir = "./source/_posts"
for dirpath, dirnames, filenames in os.walk(workDir):
    driver.logger.info('读取目录:%s' % (dirpath))
Esempio n. 13
0
 def __init__(self, context):
     is_headless = context.config.userdata.get("headless", None)
     self.driver = Driver(is_headless)
     self.context = context
     self.context.page_name = None
Esempio n. 14
0
 def setUp(self):
     '''setUp method will run before - each of our test cases
     (set up driver, launch site and other)'''
     self.driver = Driver()
     self.driver.navigate(strings.base_url)
Esempio n. 15
0
 def setUp(self):
     self.driver = Driver()
Esempio n. 16
0
 def setUp(self):
     self.driver = Driver()
     self.driver.navigate(strings.base_url)
Esempio n. 17
0
 def setUp(self):
     print('Setting up driver')
     self.driver = Driver()
     Logger.set_logger()
 def setUp(self):
     print('Setting up driver')
     self.driver = Driver()
Esempio n. 19
0
from webdriver import Driver
import time
import os
import logging

driver = Driver()
driver.setAutoClose()
url = "https://www.cnblogs.com/"
driver.open_browser(url)

driver.scrollToBootom()
Esempio n. 20
0
 def setUp(self):
     self.driver = Driver()
     self.driver.navigate(mnemonics.home)
Esempio n. 21
0
# -*- coding: utf-8 -*-
# 主函数入口文件
import random
from pageobjects import Login, Controller
from webdriver import Driver
from logger import Logger
# 列表中列出测试页面,以逗号分隔,文稿名称用单引号引着
doc_list = ['日常接待版-稳定性测试', '社会治理平台-稳定性测试']
# 初始化驱动
driver = Driver().driver
# 初始化日志
logger = Logger().get_logger()
# 登录
login = Login(driver)
login.login()
# 初始化操作控制器
controller = Controller(driver)
# 选择显示屏
controller.select_screen()
# 死循环去播放文稿的页面
while True:
    for _ in range(3):
        play_doc = random.choice(doc_list)
        result = controller.choice_doc(play_doc)
        if result is False:
            continue
        controller.start()
        controller.loop_play()
Esempio n. 22
0
 def setUp(self):
     self.driver = Driver()
     self.driver.navigate(strings.how_shift_works_url)