def input_ari_content(self, content): # iframe切换 DriverUtils.get_mp_driver().switch_to.frame( self.pub_ari_page.find_cont_iframe()) self.input_text(self.pub_ari_page.find_ari_content(), content) # 返回默认页面 DriverUtils.get_mp_driver().switch_to.default_content()
def input_ari_content(self, context): DriverUtils.get_mp_driver().switch_to.frame( self.pub_ari_page.find_ari_iframe()) # 输入文章内容 self.input_text(self.pub_ari_page.find_ari_context(), context) # 返回默认界面 DriverUtils.get_mp_driver().switch_to.default_content()
def check_ari_channel(self, channel_name): # # 点击频道框 # self.pub_ari_page.find_channel().click() # # # 发表点击 # # self.pub_ari_page.find_channel_option().click() # # 获取所有选项的列表 # channel_option = DriverUtils.get_mp_driver().find_elements_by_css_selector( # ".el-select-dropdown__item span") # is_suc = False # # 遍历所获取的频道名称 # for option in channel_option: # # 判断当前遍历的元素文本信息是否等于所想要的频道名称 # if option.text == channel_name: # # 如果相等则点击 跳出 吧默认标识改成True # option.click() # is_suc = True # break # # 不相等则 鼠标悬浮到当前遍历的元素对象上并按下向下的按钮 # else: # # 创建鼠标对象 # action = ActionChains(DriverUtils.get_mp_driver() # action.move_to_element(option).send_keys(Keys.DOWN).perform() # # 判断标识是否为False,则掏出没找到对应频道的选项 # if is_suc is False: # NoSuchElementException(f"找不到名称为{channel_name}的频道") channel_option = DriverUtils.get_mp_driver( ).find_elements_by_css_selector(".el-select-dropdown__item span") not_select_check(DriverUtils.get_mp_driver(), self.pub_ari_page.find_channel(), channel_option, channel_name)
def to_ari_iframe(self, content): # 1. iframe切换 DriverUtils.get_mp_driver().switch_to.frame( self.pub_ari_page.find_ari_iframe()) # 2. 输入文字的内容 self.input_text(self.pub_ari_page.find_ari_content(), content) # 3. 返回默认界面 DriverUtils.get_mp_driver().switch_to.default_content()
def input_ari_content(self, context): # iframe切换 DriverUtils.get_mp_driver().switch_to.frame( self.pub_ari_page.find_ari_iframe()) # 输入文章内容 self.pub_ari_page.find_ari_context().send_keys(context) # 切换回默认页面 DriverUtils.get_mp_driver().switch_to.default_content()
def setup_class(self): # 1.打开浏览器 self.driver = DriverUtils.get_mp_driver() # 创建首页业务层的对象 self.home_proxy = HomeProxy() # 创建发布文章业务层的对象 self.pub_ari_proxy = PubAriProxy()
def setup_class(self): # 获取驱动的对象 self.driver = DriverUtils.get_mp_driver() # 创建好所需要调用业务方法所在的类的对象 self.login_proxy = LoginProxy() self.home_proxy = HomeProxy() self.pub_proxy = PubAriProxy()
def setup_class(self): self.driver = DriverUtils.get_mp_driver() #登陆 self.login = LoginProxy() self.login.test_login("13911111111", "246810") self.home_proxy = HomeProxy() self.pub_ari_proxy = PubAriProxy()
def test_mp_login(self, username, verity): # 输入用户名 self.login_handle.input_username(username) # 输入验证码 self.login_handle.input_verity(verity) #截图 get_allure_picture(DriverUtils.get_mp_driver()) # 点击登录按钮 self.login_handle.click_login_but()
def test_pub_article(self, title, context, channel_name): # 输入标题内容 self.pub_ari_handle.input_ari_title(title) # 输入内容 self.pub_ari_handle.input_ari_content(context) # 选择封面 self.pub_ari_handle.check_ari_cover() # 选择频道 self.pub_ari_handle.check_ari_channel(channel_name) # 截图 get_allure_picture(DriverUtils.get_mp_driver()) # 点击发表按钮 self.pub_ari_handle.click_pub_btn()
def setup_class(self): # 2.1 获取驱动都对象 self.driver = DriverUtils.get_mp_driver() # 2.2 创建好所需要调用业务方法所在的类的对象 self.login_proxy = LoginProxy()
def setup_class(self): # 获取自媒体端的浏览器驱动对象并且赋给driver的实例属性 self.driver = DriverUtils.get_mp_driver() # 创建业务层对象 self.login_proxy = LoginPorxy()
def __init__(self): self.driver = DriverUtils.get_mp_driver()
def setup_method(self): DriverUtils.get_mp_driver().get("http://ttmp.research.itcast.cn/")
def __init__(self): # 获取浏览器驱动 self.driver = DriverUtils.get_mp_driver()
def setup_class(self): # 获取驱动对象 self.driver = DriverUtils.get_mp_driver() # 创建好所需要的调用业务方法所在的类的对象 self.login_proxy = LoginProxy()
def setup_class(self): self.driver = DriverUtils.get_mp_driver() self.home_proxy = HomePorxy() self.pub_proxy = PubPorxy()
def setup_class(self): # 启动浏览器 self.driver = DriverUtils.get_mp_driver() # 创建好对应要调用的业务层对象 self.home_proxy = HomeProxy() self.pub_art_proxy = PubArtProxy()
def setup_class(self): self.driver = DriverUtils.get_mp_driver() self.home_proxy = HomeProxy() self.pub_ari_proxy = PubAriProxy()
def setup_class(self): self.driver = DriverUtils.get_mp_driver() self.login_proxy = LoginProxy()
def __init__(self): # 获取自媒体端的浏览器驱动对象 self.driver = DriverUtils.get_mp_driver()
def input_article_content(self, content): DriverUtils.get_mp_driver().switch_to.frame( self.pub_article_page.find_frame_ele()) self.input_text(self.pub_article_page.find_article_content(), content) DriverUtils.get_mp_driver().switch_to.default_content()
def setup_class(self): # 打开浏览器 self.driver = DriverUtils.get_mp_driver() # 创建所需要页面的业务层的对象 self.home_proxy = HomePorxy() self.pub_proxy = PubProxy()
def click_choose_channel(self, channel_name): check_channel_option(DriverUtils.get_mp_driver(), "请选择", channel_name)
def check_ari_channel(self, channel_name): # 调用工具类中的公用下拉框选择方法 check_channel_option(DriverUtils.get_mp_driver(), "请选择", channel_name)
def check_target_channel(self, option_name): select_option(DriverUtils.get_mp_driver(), "请选择", option_name)
def setup_class(self): # 启动浏览器 self.driver = DriverUtils.get_mp_driver() # 创建好对应要调用的业务层对象 self.login_proxy = LoginProxy()
def setup_class(self): # 2.1 实例化浏览器驱动对象 self.driver = DriverUtils.get_mp_driver() # 2.2 实例化需调用的业务方法所在类的对象 self.home_proxy = HomeProxy() self.pub_ari_proxy = PubAriProxy()
def __init__(self): self.pub_page = PubAriPage() self.driver = DriverUtils.get_mp_driver()
def __init__(self): self.pub_page = PulPage() # 因为切换iframe需要使用到driver,所以要实例化浏览器驱动对象 self.driver = DriverUtils.get_mp_driver()