Exemple #1
0
class Test(unittest.TestCase):
    def setUp(self):
        self.brower = BasePage()
        self.url = 'http://ad.cjs.com.cn/template/html/42/5b46bbc2afd42.html'
        self.brower.open_url(self.url)

    #def tearDown(self):
    # 关闭浏览器
    #self.brower.quit_browser()

    def test_url2(self):
        self.brower.type('//*[@id="mobilePhone"]', 17623250366)
        #self.assertEqual(self.brower.driver.title,u"精准测股系统")
        time.sleep(2)
        self.brower.click("/html/body/div[11]/div/a")
        time.sleep(2)
        '''
		time.sleep(2)
		self.brower.click('//*[@id="btnSave"]')
		self.brower.type('//*[@id="mobilePhone"]',17623250366)
		time.sleep(10)
		#self.brower.d()
		#self.brower.get_page_source()
		#领取
		self.brower.click("/html/body/div[1]/div/div/div/ul/li[3]/button")
		time.sleep(10)
		#已注册弹窗提示
		self.al=self.brower.driver.switch_to.alert
		self.assertEqual(self.al.text,u"已注册手机号!")
		time.sleep(2)
		'''
        self.brower.quit_url()
Exemple #2
0
class LoginPage():
    def __init__(self, driver: WebDriver):
        self.b = BasePage(driver)

    def login(self, username, password, vec):
        # b = BasePage(driver)
        self.b.send_keys(lp.user_input, username)
        self.b.send_keys(lp.psw_input, password)
        self.b.send_keys(lp.vec_input, vec)
        self.b.click(lp.login_but)

    def error_msg(self):
        return self.b.get_text(lp.error_text)
Exemple #3
0
class Test(unittest.TestCase):
    def setUp(self):
        self.brower = BasePage()
        '''
		params={"user_token":'market_12'}
		text=rg.request_post("https://fulldev.yjifs.com/tools/tools/get_technical_choose_data?technical_name=KDJ1")
		text_urls=test['datas']
		for url in text_url:
		'''
        self.url = 'http://ad.cjs.com.cn/template/html/81/5b46bbcbcb081.html'
        self.brower.open_url(self.url)

    def test_nbsr(self):
        #股票代码输入
        self.brower.type('//*[@id="gp"]', 6)
        self.assertEqual(self.brower.driver.title, u"精准测股系统")
        time.sleep(2)
        self.brower.click(
            "/html/body/div[3]/div[1]/div[2]/div[2]/ul/div/div[1]")
        time.sleep(2)
        self.brower.click('//*[@id="btnSave"]')
        self.brower.type('//*[@id="mobilePhone"]', 17623250366)
        #领取
        self.brower.click("/html/body/div[1]/div/div/div/ul/li[3]/button")
        time.sleep(2)
        #已注册弹窗提示
        self.al = self.brower.driver.switch_to.alert
        self.assertEqual(self.al.text, u"已注册手机号!")
        time.sleep(2)
        self.brower.quit_url()
Exemple #4
0
class MenuManagement():
    def __init__(self, driver: WebDriver):
        self.b = BasePage(driver)

    def in_menu_manage(self):
        self.b.click(menuloc.sys_manage)
        self.b.click(menu.menu_manage_loc)
        self.b.switch_frame(menu.menu_manage_frame)

    def add_menu(self, name, url, sort):
        self.in_menu_manage()
        self.b.click(menu.add_but)
        self.b.send_keys(menu.name_input, name)
        self.b.send_keys(menu.url_input, url)
        self.b.send_keys(menu.sort_input, sort)
        self.b.click(menu.save_but)

    def delete_menu(self):
        self.b.refresh()  #刷新
        self.in_menu_manage()
        MyLog().info(f"按钮位置:{menu.dele_menu_but}")
        self.b.click(menu().dele_menu_but)
        self.b.accept_alert()