예제 #1
0
 def test_invite_03(self):
     '''点击推广大使邀请按钮,进入分享界面,在点击复制链接按钮,在新窗口打开'''
     self.m.js_scrollTop("2000")
     self.m.click_inviteImg05()
     self.m.click_copyUrl()
     url = self.m.get_url()
     #   获取当前浏览器的句柄
     window_1 = self.driver.current_window_handle
     print(window_1)
     #   用火狐浏览器打开链接
     self.driver2 = webdriver.Firefox()
     self.driver2.get(url)
     self.l2 = LoginFun(self.driver2)
     self.m2 = My(self.driver2)
     #   获取全部浏览器句柄,在进行判断,判断与之前的浏览器句柄是否一致,如果不一致切换到该浏览器窗口
     windows = self.driver2.window_handles
     print(windows)
     for current_window in windows:
         if current_window != window_1:
             self.driver2.switch_to.window(current_window)
     time.sleep(5)
     #   获取当前浏览器URL
     newurl = self.driver2.current_url
     print(newurl)
     self.assertEqual(newurl,"http://byhm.520shq.com/#/login")
     #   对第二个界面进行操作
     loc_user = (By.CSS_SELECTOR,"[placeholder='输入手机号码']")
     self.m2.is_displayed_ele(loc_user)
     self.l2.loginy("13600008888","a12345")
     self.driver.switch_to.window(window_1)
예제 #2
0
 def setUpClass(cls):
     cls.driver = simu_driver()
     cls.l = LoginFun(cls.driver)
     cls.h = Home(cls.driver)
예제 #3
0
파일: seek.py 프로젝트: BAndW-G/bytest
        self.clk(loc_seek_x)

    def click_clear_history(self):
        #   点击清除按钮,清除历史记录。(只有在进行过搜索后才会有历史记录)
        self.clk(loc_clear_history)

    def click_history(self):
        #   点击历史记录,搜索商家。(进入搜索界面)(只有在进行过搜索后才会有历史记录)
        self.clk(loc_click_history)

    def click_back(self):
        #   返回上一页
        self.clk(loc_back_home)

    def get_seek_text(self):
        #   获取搜索提示文本    请输入搜索关键词。
        t = self.rtext(loc_seek_text)
        return t


if __name__ == "__main__":
    #   测试
    driver = simu_driver()
    driver.get('http://byhm.520shq.com/#/login')
    driver.maximize_window()
    cs = LoginFun(driver)
    cs.login()
    cs = Home(driver)
    cs.click_home_input()
    cs = Seek(driver)
    cs.click_seek()
예제 #4
0
 def setUpClass(cls):
     cls.driver = simu_driver()
     cls.l = LoginFun(cls.driver)
     cls.s = Homeshop(cls.driver)
     cls.r = Location(cls.driver)
예제 #5
0
파일: register.py 프로젝트: BAndW-G/bytest
    def click_button(self):
        #   定位注册按钮
        self.clk(loc_button)

    def click_back_login(self):
        #   返回登录界面
        self.clk(loc_back_login)

    def get_sucess(self):
        #   获取注册返回提示
        t = self.rtext(loc_sucessx)
        print(t)
        return t


if __name__ == "__main__":
    driver = webdriver.Chrome()
    driver.get("http://byhm.520shq.com/#/login")
    cs = LoginFun(driver)
    cs1 = Register(driver)
    cs.click_registered()
    # cs1.input_user(user = "******")
    cs1.click_vc()
    # cs1.input_vc(vc="1234")
    # cs1.input_pwd("asdadasd")
    # cs1.click_icon_eye()
    # cs1.click_button()
    # cs1.click_back_login()
    # cs1.get_sucess()
예제 #6
0
파일: location.py 프로젝트: BAndW-G/bytest
    def get_loca_text(self):
        #   地址信息
        t = self.rtext(loc_current_location)
        return t[5:]

    def click_switch_area(self, p="广东", city="广州", county="天河"):
        #   切换地区
        loc_area_p = (By.XPATH, "//span[contains(text(),'%s')]" % p)
        loc_area_city = ("xpath", "//span[contains(text(),'%s')]" % city)
        loc_area_county = ("xpath", "//span[contains(text(),'%s')]" % county)
        self.clk(loc_area_p)
        self.clk(loc_area_city)
        self.clk(loc_area_county)

    def click_back_home(self):
        #   返回首页
        self.clk(loc_back_home)


if __name__ == "__main__":
    #   测试
    driver = simu_driver()
    driver.get('http://byhm.520shq.com/#/login')
    driver.maximize_window()
    cs = LoginFun(driver)
    cs.login()
    loc_orientation = (By.XPATH, "//header[@class='mint-header']/a")
    cs.clk(loc_orientation)
    cs = Location(driver)
    cs.click_switch_area()
예제 #7
0
 def setUpClass(cls):
     #打开浏览器
     cls.driver = webdriver.Chrome()
     #实例化 LoginFun
     cls.logfun = LoginFun(cls.driver)
예제 #8
0
 def setUpClass(cls):
     cls.driver = simu_driver()
     cls.l = LoginFun(cls.driver)
     cls.r = Register(cls.driver)
예제 #9
0
파일: benefits.py 프로젝트: BAndW-G/bytest
    def click_gain_cards(self):
        #   显示消费券的获赠记录
        self.clk(loc_gain_cards)

    def click_senk_cards(self):
        #   显示消费券的送出记录
        self.clk(loc_senk_cards)

    def get_list_total(self):
        #   获取次数数量
        t = self.get_list_number(loc_ul)
        print(t)
        return t

    def get_num(self):
        #   获取界面显示的次数
        t = self.rtext(loc_num)
        return t

if __name__ == "__main__":
    #   测试
    driver = simu_driver()
    driver.get('http://byhm.520shq.com/#/login')
    driver.maximize_window()
    cs = LoginFun(driver)
    cs.login()
    cs = Benefits(driver)
    cs.click_cut()
    time.sleep(5)
    cs.click_cards_particulars()
    cs.get_list_num()
예제 #10
0
파일: operation.py 프로젝트: BAndW-G/bytest
    def get_opr_color(self):
        #   获取运营商字体颜色
        t = self.get_rpg(loc_cut_oprator)
        return t

    def get_oper_earning(self):
        #   获取运营商的发展总收益数值
        t = self.rtext(loc_oper_earnings)
        t = int(t[1:])
        return t

    def get_gains_oper(self, n=0):
        #   获取运营商的收益明细页面的数值
        n = +1
        ele = ("//li[%s]//span[@class='price']" % n)
        t = driver.find_element_by_xpath(ele)
        t = int(t[2:])


if __name__ == "__main__":
    #   测试
    driver = simu_driver()
    driver.get('http://byhm.520shq.com/#/login')
    driver.maximize_window()
    cs = LoginFun(driver)
    cs.login()
    cs = Operation(driver)
    cs.click_cut()
    time.sleep(5)
    cs.get_oper_earning()
예제 #11
0
 def setUpClass(cls):
     cls.driver = simu_driver()
     cls.l = LoginFun(cls.driver)
     cls.m = My(cls.driver)
     cls.u = Userlevel(cls.driver)
예제 #12
0
class Invite(unittest.TestCase):
    '''邀请用户注册测试'''
    @classmethod
    def setUpClass(cls):
        cls.driver = simu_driver()
        cls.l = LoginFun(cls.driver)
        cls.m = My(cls.driver)
        cls.u = Userlevel(cls.driver)

    def setUp(self):
        self.driver.get("http://byhm.520shq.com/#/login")
        self.driver.maximize_window()
        self.l.login()
        self.m.click_cut()

    def test_invite_01(self):
        '''显示出的邀请链接等级与运营商用户等级是否一致'''
        locli = (By.XPATH,"//div[@class='peopleClass inviteImg']//li//p")
        t = self.u.ulevel()
        s = self.m.rtext(locli)
        print(s)
        self.assertEqual(t,s)

    def test_invite_02(self):
        '''点击vip邀请按钮,进入分享界面,在点击复制链接按钮,在新窗口打开'''
        self.m.js_scrollTop("2000")
        self.m.click_inviteImg06()
        self.m.click_copyUrl()
        url = self.m.get_url()
        #   获取当前浏览器的句柄
        window_1 = self.driver.current_window_handle
        print(window_1)
        #   用火狐浏览器打开链接
        self.driver2 = webdriver.Firefox()
        self.driver2.get(url)
        self.l2 = LoginFun(self.driver2)
        self.m2 = My(self.driver2)
        #   获取全部浏览器句柄,在进行判断,判断与之前的浏览器句柄是否一致,如果不一致切换到该浏览器窗口
        windows = self.driver2.window_handles
        print(windows)
        for current_window in windows:
            if current_window != window_1:
                self.driver2.switch_to.window(current_window)
        time.sleep(5)
        #   获取当前浏览器URL
        newurl = self.driver2.current_url
        print(newurl)
        self.assertEqual(newurl,"http://byhm.520shq.com/#/login")
        #   对第二个界面进行操作
        loc_user = (By.CSS_SELECTOR,"[placeholder='输入手机号码']")
        self.m2.is_displayed_ele(loc_user)
        self.l2.loginy("13600008888","a12345")
        self.driver.switch_to.window(window_1)

    def test_invite_03(self):
        '''点击推广大使邀请按钮,进入分享界面,在点击复制链接按钮,在新窗口打开'''
        self.m.js_scrollTop("2000")
        self.m.click_inviteImg05()
        self.m.click_copyUrl()
        url = self.m.get_url()
        #   获取当前浏览器的句柄
        window_1 = self.driver.current_window_handle
        print(window_1)
        #   用火狐浏览器打开链接
        self.driver2 = webdriver.Firefox()
        self.driver2.get(url)
        self.l2 = LoginFun(self.driver2)
        self.m2 = My(self.driver2)
        #   获取全部浏览器句柄,在进行判断,判断与之前的浏览器句柄是否一致,如果不一致切换到该浏览器窗口
        windows = self.driver2.window_handles
        print(windows)
        for current_window in windows:
            if current_window != window_1:
                self.driver2.switch_to.window(current_window)
        time.sleep(5)
        #   获取当前浏览器URL
        newurl = self.driver2.current_url
        print(newurl)
        self.assertEqual(newurl,"http://byhm.520shq.com/#/login")
        #   对第二个界面进行操作
        loc_user = (By.CSS_SELECTOR,"[placeholder='输入手机号码']")
        self.m2.is_displayed_ele(loc_user)
        self.l2.loginy("13600008888","a12345")
        self.driver.switch_to.window(window_1)

    def test_invite_04(self):
        '''点击运营商邀请按钮,进入分享界面,在点击复制链接按钮,在新窗口打开'''
        self.m.js_scrollTop("2000")
        self.m.click_inviteImg04()
        self.m.click_copyUrl()
        url = self.m.get_url()
        #   获取当前浏览器的句柄
        window_1 = self.driver.current_window_handle
        print(window_1)
        #   用火狐浏览器打开链接
        self.driver2 = webdriver.Firefox()
        self.driver2.get(url)
        self.l2 = LoginFun(self.driver2)
        self.m2 = My(self.driver2)
        #   获取全部浏览器句柄,在进行判断,判断与之前的浏览器句柄是否一致,如果不一致切换到该浏览器窗口
        windows = self.driver2.window_handles
        print(windows)
        for current_window in windows:
            if current_window != window_1:
                self.driver2.switch_to.window(current_window)
        time.sleep(5)
        #   获取当前浏览器URL
        newurl = self.driver2.current_url
        print(newurl)
        self.assertEqual(newurl,"http://byhm.520shq.com/#/login")
        #   对第二个界面进行操作
        loc_user = (By.CSS_SELECTOR,"[placeholder='输入手机号码']")
        self.m2.is_displayed_ele(loc_user)
        self.l2.loginy("13600008888","a12345")
        self.driver.switch_to.window(window_1)

    def test_invite_05(self):
        '''点击县运营商邀请按钮,进入分享界面,在点击复制链接按钮,在新窗口打开'''
        self.m.js_scrollTop("2000")
        self.m.click_inviteImg03()
        self.m.click_copyUrl()
        url = self.m.get_url()
        #   获取当前浏览器的句柄
        window_1 = self.driver.current_window_handle
        print(window_1)
        #   用火狐浏览器打开链接
        self.driver2 = webdriver.Firefox()
        self.driver2.get(url)
        self.l2 = LoginFun(self.driver2)
        self.m2 = My(self.driver2)
        #   获取全部浏览器句柄,在进行判断,判断与之前的浏览器句柄是否一致,如果不一致切换到该浏览器窗口
        windows = self.driver2.window_handles
        print(windows)
        for current_window in windows:
            if current_window != window_1:
                self.driver2.switch_to.window(current_window)
        time.sleep(5)
        #   获取当前浏览器URL
        newurl = self.driver2.current_url
        print(newurl)
        self.assertEqual(newurl,"http://byhm.520shq.com/#/login")
        #   对第二个界面进行操作
        loc_user = (By.CSS_SELECTOR,"[placeholder='输入手机号码']")
        self.m2.is_displayed_ele(loc_user)
        self.l2.loginy("13600008888","a12345")
        self.driver.switch_to.window(window_1)

    def test_invite_06(self):
        '''点击市运营商邀请按钮,进入分享界面,在点击复制链接按钮,在新窗口打开'''
        self.m.js_scrollTop("2000")
        self.m.click_inviteImg02()
        self.m.click_copyUrl()
        url = self.m.get_url()
        #   获取当前浏览器的句柄
        window_1 = self.driver.current_window_handle
        print(window_1)
        #   用火狐浏览器打开链接
        self.driver2 = webdriver.Firefox()
        self.driver2.get(url)
        self.l2 = LoginFun(self.driver2)
        self.m2 = My(self.driver2)
        #   获取全部浏览器句柄,在进行判断,判断与之前的浏览器句柄是否一致,如果不一致切换到该浏览器窗口
        windows = self.driver2.window_handles
        print(windows)
        for current_window in windows:
            if current_window != window_1:
                self.driver2.switch_to.window(current_window)
        time.sleep(5)
        #   获取当前浏览器URL
        newurl = self.driver2.current_url
        print(newurl)
        self.assertEqual(newurl,"http://byhm.520shq.com/#/login")
        #   对第二个界面进行操作
        loc_user = (By.CSS_SELECTOR,"[placeholder='输入手机号码']")
        self.m2.is_displayed_ele(loc_user)
        self.l2.loginy("13600008888","a12345")
        self.driver.switch_to.window(window_1)

    def test_invite_07(self):
        '''点击省运营商邀请按钮,进入分享界面,在点击复制链接按钮,在新窗口打开'''
        self.m.js_scrollTop("2000")
        self.m.click_inviteImg01()
        self.m.click_copyUrl()
        url = self.m.get_url()
        #   获取当前浏览器的句柄
        window_1 = self.driver.current_window_handle
        print(window_1)
        #   用火狐浏览器打开链接
        self.driver2 = webdriver.Firefox()
        self.driver2.get(url)
        self.l2 = LoginFun(self.driver2)
        self.m2 = My(self.driver2)
        #   获取全部浏览器句柄,在进行判断,判断与之前的浏览器句柄是否一致,如果不一致切换到该浏览器窗口
        windows = self.driver2.window_handles
        print(windows)
        for current_window in windows:
            if current_window != window_1:
                self.driver2.switch_to.window(current_window)
        time.sleep(5)
        #   获取当前浏览器URL
        newurl = self.driver2.current_url
        print(newurl)
        self.assertEqual(newurl,"http://byhm.520shq.com/#/login")
        #   对第二个界面进行操作
        loc_user = (By.CSS_SELECTOR,"[placeholder='输入手机号码']")
        self.m2.is_displayed_ele(loc_user)
        self.l2.loginy("13600008888","a12345")
        self.driver.switch_to.window(window_1)
예제 #13
0
    def click_cut(self):
        #   切换底部菜单栏  a[1]:首页   a[2]:运营中心  a[3]:用户福利  a[4]:店铺查询  a[5]:我的
        self.clk(loc_cut)

    def click_prompt_order(self):
        #   未支付订单提示
        self.clk(loc_prompt_order)

    def get_order_text(self):
        #   获取订单界面文本
        t = self.rtext(loc_order_text)
        return t

    def get_color_value(self):
        #   获取界面元素的color值
        t = self.get_back_color(loc_active_color)
        return t


if __name__ == "__main__":
    #   测试
    driver = simu_driver()
    driver.get('http://byhm.520shq.com/#/login')
    driver.maximize_window()
    cs = LoginFun(driver)
    cs.login()
    cs = Home(driver)
    cs.get_color_value()
    js = "var q=document.documentElement.scrollTop=10000"
    driver.execute_script(js)
예제 #14
0
 def setUpClass(cls):
     cls.driver = simu_driver()
     cls.l = LoginFun(cls.driver)
     cls.s = Shop(cls.driver)
예제 #15
0
 def setUpClass(cls):
     cls.driver = simu_driver()
     cls.l = LoginFun(cls.driver)
     cls.b = Benefits(cls.driver)