示例#1
0
 def test_search_005(self):
     """测试搜索取消功能"""
     Login(self.wd).test_login002("13253728975", "123456w")
     Base(self.wd).ClickElement(By.XPATH,
                                '//*[@id="app"]/div[2]/div[2]/div[4]')
     time.sleep(1)
     Base(self.wd).ClickElement(
         By.CSS_SELECTOR,
         '#app>div:nth-child(2)>div:nth-child(1)>div.discover-search>div')
     print(5)
     time.sleep(2)
     Base(self.wd).sendKeys(
         By.CSS_SELECTOR,
         '#app > div:nth-child(2) > div.search-input > div > div > div > input[type=text]',
         '朝花夕拾')
     time.sleep(2)
     Base(self.wd).ClickElement(
         By.CSS_SELECTOR,
         '#app>div:nth-child(2)>div.search-input>div>span.cancel')
     print(5)
     text = Base(self.wd).text(
         By.CSS_SELECTOR,
         '#app > div:nth-child(2) > div:nth-child(1) > div.van-list > div:nth-child(1) > div:nth-child(1) > div.list-title > span'
     )
     assert text == '根据《零点超控》推荐'
示例#2
0
    def test_search_006(self):
        """测试搜索搜索功能"""
        Login(self.wd).test_login002("13253728975", "123456w")
        Base(self.wd).ClickElement(By.XPATH,
                                   '//*[@id="app"]/div[2]/div[2]/div[4]')
        Base(self.wd).ClickElement(By.XPATH,
                                   '//*[@id="app"]/div[2]/div[1]/div[1]/div')
        time.sleep(2)
        Base(self.wd).sendKeys(
            By.CSS_SELECTOR,
            '#app > div:nth-child(2) > div.search-input > div > div > div > input[type=text]',
            '朝花夕拾')
        time.sleep(2)
        Base(self.wd).ClickElement(By.XPATH,
                                   '//*[@id="app"]/div[2]/div[1]/div/span[2]')
        all = WebDriverWait(
            self.wd, 30,
            1).until(lambda x: x.find_elements(By.CSS_SELECTOR, '.item-title'))
        text = all[1].text
        print(text)
        try:

            self.wd.find_element_by_xpath("//*[contains(text(),'朝花夕拾')]")
        except:
            return False
示例#3
0
 def test_index_001(self):
     """测试首页是否正常显示"""
     try:
         word=Base(self.wd).text(By.XPATH,'//*[@id="app"]/div[2]/div[1]/div[3]/div[3]/div')
         assert word=="完本"
     except:
         word2=Base(self.wd).text(By.XPATH,'//*[@id="app"]/div[2]/div[1]/div[1]/div[2]/div[1]/div/div[2]/span')
         assert word2 == "男生"
示例#4
0
 def test_search_002(self):
     """测试不登陆时的--发现——会不会出现登陆页面"""
     Base(self.wd).ClickElement(By.XPATH,
                                '//*[@id="app"]/div[2]/div[2]/div[4]')
     print('002')
     sub = Base(self.wd).text(By.XPATH,
                              '//*[@id="app"]/div[2]/div[2]/div[3]/span')
     assert sub == '登录'
示例#5
0
 def test_login001(self):
     """测试登陆页面是否正常"""
     # 获取登录按钮
     Base(self.wd).ClickElement(
         By.XPATH, '//*[@id="app"]/div[2]/div[1]/div[1]/div[1]/div[3]')
     print(1)
     btn = Base(self.wd).text(By.XPATH,
                              '//*[@id="app"]/div[2]/div[2]/div[3]/span')
     assert btn == "登录"
示例#6
0
 def test_login003(self):
     """测试无密码手机号状态登录"""
     Base(self.wd).ClickElement(
         By.CSS_SELECTOR,
         '#app > div:nth-child(2) > div.container > div.login > span')
     time.sleep(2)
     dom = Base(self.wd).exct(
         By.CSS_SELECTOR, 'body > div.van-toast.van-toast--middle > div')
     assert dom == True
示例#7
0
 def test_BookCty_002(self):
     """测试--书成--男生"""
     Base(self.wd).ClickElement(
         By.XPATH,
         '//*[@id="app"]/div[2]/div[1]/div[1]/div[2]/div[1]/div/div[2]/span'
     )
     print("002")
     text = Base(self.wd).text(
         By.XPATH, '//*[@id="app"]/div[2]/div[1]/div[3]/div[3]/div')
     assert text == "榜单"
示例#8
0
 def test_search_003(self):
     """测试登录过的--发现--页面是否正常"""
     Login(self.wd).test_login002("13253728975", "123456w")
     Base(self.wd).ClickElement(By.XPATH,
                                '//*[@id="app"]/div[2]/div[2]/div[4]')
     print(3)
     text = Base(self.wd).text(
         By.XPATH,
         '//*[@id="app"]/div[2]/div[1]/div[2]/div[1]/div[1]/div[1]/span')
     assert text == '根据《零点超控》推荐'
示例#9
0
 def test_register002(self):
     """是否有注册按钮"""
     Base(self.wd).FindElement(
         By.CSS_SELECTOR,
         '#app > div:nth-child(2) > div.container > div:nth-child(4)'
     ).click()
     time.sleep(2)
     dom = Base(self.wd).exct(
         By.CSS_SELECTOR,
         '#app > div:nth-child(2) > div.container > div.login > span')
     assert dom == True
示例#10
0
 def test_bookra_002(self):
     """测试未登录时书架会不会显示登陆页面"""
     Base(self.wd).ClickElement(
         By.CSS_SELECTOR,
         '#app > div:nth-child(2) > div.van-hairline--top-bottom.van-tabbar.van-tabbar--fixed > div:nth-child(1)'
     )
     tex = Base(self.wd).text(
         By.CSS_SELECTOR,
         '#app > div:nth-child(2) > div.container > div.login > span')
     print(2)
     assert tex == '登录'
示例#11
0
 def test_BookCty_011(self):
     """测试--书成--出版"""
     Base(self.wd).ClickElement(
         By.XPATH,
         '//*[@id="app"]/div[2]/div[1]/div[1]/div[2]/div[1]/div/div[4]/span'
     )
     print('011')
     text = Base(self.wd).text(
         By.XPATH,
         '//*[@id="app"]/div[2]/div[1]/div[4]/div[1]/div/div[1]/div[1]')
     time.sleep(1)
     assert text == "小编热推"
示例#12
0
 def test_BookCty_004(self):
     """测试--书成--男生模块--玄幻页面是否正常--"""
     Base(self.wd).ClickElement(
         By.XPATH,
         '//*[@id="app"]/div[2]/div[1]/div[1]/div[2]/div[1]/div/div[2]/span'
     )
     Base(self.wd).ClickElement(
         By.XPATH, '//*[@id="app"]/div[2]/div[1]/div[3]/div[1]/img')
     print('004')
     text = Base(self.wd).text(By.XPATH,
                               '//*[@id="app"]/div[2]/div[1]/div[2]')
     assert text == '玄幻'
示例#13
0
    def test_main_007(self):
        """测试底部——意见反馈--功能"""
        Login(self.wd).test_login002("13253728975", "123456w")
        Base(self.wd).ClickElement(By.XPATH, '//*[@id="app"]/div[2]/div[2]/div[5]')
        self.wd.execute_script("window.scrollTo(0,document.body.scrollHeight)")
        time.sleep(2)
        js = 'document.getElementsByClassName("van-cell__title")[5].click();'
        self.wd.execute_script(js)
        print(7)

        sub=Base(self.wd).text(By.XPATH,'//*[@id="app"]/div[2]/div[3]/span')
        assert sub=='确认提交'
示例#14
0
 def test_main_010(self):
     """测试——我要分享--页面是否正常"""
     Login(self.wd).test_login002("13253728975", "123456w")
     Base(self.wd).ClickElement(By.XPATH, '//*[@id="app"]/div[2]/div[2]/div[5]')
     time.sleep(2)
     Base(self.wd).ClickElement(By.XPATH, '//*[@id="app"]/div[2]/div[1]/div[3]/div[1]/div')
     self.wd.execute_script("window.scrollTo(0,document.body.scrollHeight)")
     time.sleep(2)
     print(10)
     copy = Base(self.wd).text(By.XPATH, '//*[@id="app"]/div[2]/div[2]/div[3]/span[1]')
     print(10.1)
     assert copy=="复制链接"
示例#15
0
 def test_BookCty_003(self):
     """测试--书成--男生模块--都市页面是否正常--"""
     Base(self.wd).ClickElement(
         By.XPATH,
         '//*[@id="app"]/div[2]/div[1]/div[1]/div[2]/div[1]/div/div[2]/span'
     )
     Base(self.wd).ClickElement(
         By.XPATH, '//*[@id="app"]/div[2]/div[1]/div[3]/div[2]')
     print('003')
     text = Base(self.wd).text(By.CSS_SELECTOR,
                               '.van-nav-bar__title van-ellipsis')
     assert text == '都市'
示例#16
0
 def test_register001(self):
     """注册页面就简单测下"""
     """测试注册页面是否正常"""
     Base(self.wd).FindElement(
         By.CSS_SELECTOR,
         '#app > div:nth-child(2) > div.container > div:nth-child(4)'
     ).click()
     dom = Base(self.wd).exct(
         By.CSS_SELECTOR,
         '#app > div:nth-child(2) > div.container > div:nth-child(2) > div.item-body > div > div > button'
     )
     assert dom == True
示例#17
0
 def test_search_004(self):
     """测试搜索框是否可以点击和输入"""
     Login(self.wd).test_login002("13253728975", "123456w")
     Base(self.wd).ClickElement(By.XPATH,
                                '//*[@id="app"]/div[2]/div[2]/div[4]')
     print(4)
     time.sleep(2)
     Base(self.wd).ClickElement(By.XPATH,
                                '//*[@id="app"]/div[2]/div[1]/div[1]/div')
     print(4)
     time.sleep(2)
     Base(self.wd).sendKeys(
         By.XPATH, '//*[@id="app"]/div[2]/div[1]/div/div/div/input', '朝花夕拾')
示例#18
0
 def test_register003(self):
     """测试注册页面登录按钮是否存在"""
     Base(self.wd).FindElement(
         By.CSS_SELECTOR,
         '#app > div:nth-child(2) > div.container > div:nth-child(4)'
     ).click()
     time.sleep(2)
     self.wd.execute_script('window.scrollTo(0,document.body.scrollHeight)')
     time.sleep(2)
     dom = Base(self.wd).exct(
         By.CSS_SELECTOR,
         '#app > div:nth-child(2) > div.container > div:nth-child(7)')
     assert dom == True
示例#19
0
 def test_bookra_004(self):
     """检测是否显示书架页面2"""
     Login(self.wd).test_login002("13253728975", "123456w")
     Base(self.wd).ClickElement(
         By.CSS_SELECTOR,
         '#app > div:nth-child(2) > div.van-hairline--top-bottom.van-tabbar.van-tabbar--fixed > div:nth-child(1)'
     )
     time.sleep(2)
     tex = Base(self.wd).FindElement(
         By.CSS_SELECTOR,
         '#app > div:nth-child(2) > div:nth-child(1) > div.van-nav-bar.van-hairline--bottom > div.van-nav-bar__title.van-ellipsis'
     )
     cc = tex.text
     assert cc == "我的书架"
示例#20
0
 def test_login004(self):
     """测试密码框为空登录"""
     Base(self.wd).sendKeys(
         By.CSS_SELECTOR,
         '#app > div:nth-child(2) > div.container > div:nth-child(1) > div.item-body > div > div > input[type=number]',
         '13253728975')
     time.sleep(2)
     Base(self.wd).ClickElement(
         By.CSS_SELECTOR,
         '#app > div:nth-child(2) > div.container > div.login > span')
     time.sleep(2)
     dom = Base(self.wd).exct(
         By.CSS_SELECTOR, 'body > div.van-toast.van-toast--middle > div')
     assert dom == True
示例#21
0
 def test_BookCty_010(self):
     """测试--书成--女生模块--榜单页面是否正常--"""
     Base(self.wd).ClickElement(
         By.XPATH,
         '//*[@id="app"]/div[2]/div[1]/div[1]/div[2]/div[1]/div/div[3]/span'
     )
     Base(self.wd).ClickElement(
         By.XPATH, '//*[@id="app"]/div[2]/div[1]/div[3]/div[3]/img')
     print('010')
     # time.sleep(2)
     text = Base(self.wd).text(By.XPATH,
                               '//*[@id="app"]/div[2]/div[1]/div[2]')
     print(text)
     assert text == '榜单'
示例#22
0
 def test_login005(self):
     """测试手机输入框为空时"""
     Base(self.wd).sendKeys(
         By.CSS_SELECTOR,
         '#app > div:nth-child(2) > div.container > div:nth-child(2) > div.item-body > div > div > input[type=password]',
         '123456w')
     time.sleep(1)
     Base(self.wd).ClickElement(
         By.CSS_SELECTOR,
         '#app > div:nth-child(2) > div.container > div.login > span')
     time.sleep(2)
     dom = Base(self.wd).exct(
         By.CSS_SELECTOR, 'body > div.van-toast.van-toast--middle > div')
     assert dom == True
示例#23
0
 def test_bookra_003(self):
     """检测是否显示书架页面1"""
     Login(self.wd).test_login002("13253728975", "123456w")
     Base(self.wd).ClickElement(
         By.CSS_SELECTOR,
         '#app > div:nth-child(2) > div.van-hairline--top-bottom.van-tabbar.van-tabbar--fixed > div:nth-child(1)'
     )
     time.sleep(2)
     self.wd.execute_script('window.scrollTo(0,document.body.scrollHeight)')
     cc = Base(self.wd).exct(
         By.CSS_SELECTOR,
         '#app > div:nth-child(2) > div:nth-child(1) > div.bookCon > div:nth-child(10) > div'
     )
     assert cc == True
示例#24
0
 def test_main_011(self):
     """测试——我要分享--页面是否可以复制链接和复制推广码"""
     Login(self.wd).test_login002("13253728975", "123456w")
     Base(self.wd).ClickElement(By.XPATH, '//*[@id="app"]/div[2]/div[2]/div[5]')
     Base(self.wd).ClickElement(By.XPATH, '//*[@id="app"]/div[2]/div[1]/div[3]/div[1]/div')
     self.wd.execute_script("window.scrollTo(0,document.body.scrollHeight)")
     time.sleep(2)
     print(11)
     Base(self.wd).ClickElement(By.XPATH, '//*[@id="app"]/div[2]/div[2]/div[3]/span[1]')
     time.sleep(2)
     try:
         self.wd.find_element_by_xpath("//*[contains(text(),'复制成功')]")
     except:
         return False
示例#25
0
 def test_main_008(self):
     """测试底部——意见反馈--输入少于10个字"""
     Login(self.wd).test_login002("13253728975", "123456w")
     Base(self.wd).ClickElement(By.XPATH, '//*[@id="app"]/div[2]/div[2]/div[5]')
     self.wd.execute_script("window.scrollTo(0,document.body.scrollHeight)")
     print(8.1)
     time.sleep(2)
     js = 'document.getElementsByClassName("van-cell__title")[5].click();'
     self.wd.execute_script(js)
     time.sleep(2)
     Base(self.wd).sendKeys(By.XPATH,'//*[@id="app"]/div[2]/div[2]/div[1]/div/div/textarea',"你好")
     print(8)
     Base(self.wd).ClickElement(By.XPATH, '//*[@id="app"]/div[2]/div[3]/span')
     time.sleep(2)
     sub = Base(self.wd).text(By.XPATH, '/html/body/div[2]/div')
     assert sub == '反馈内容不能少于10个字'
示例#26
0
 def test_login001(self):
     """测试登陆页面是否正常显示1"""
     dom = Base(self.wd).exct(
         By.CSS_SELECTOR,
         '#app > div:nth-child(2) > div.container > div:nth-child(1) > div.item-body > div > div'
     )
     assert dom == True
示例#27
0
 def test_register004(self):
     """测试注册页面登录按钮是否可以按"""
     Base(self.wd).FindElement(
         By.CSS_SELECTOR,
         '#app > div:nth-child(2) > div.container > div:nth-child(4)'
     ).click()
     time.sleep(2)
     self.wd.execute_script('window.scrollTo(0,document.body.scrollHeight)')
     Base(self.wd).ClickElement(
         By.CSS_SELECTOR,
         '#app > div:nth-child(2) > div.container > div:nth-child(7)')
     time.sleep(2)
     tex = Base(self.wd).text(
         By.CSS_SELECTOR,
         '#app > div:nth-child(2) > div.van-nav-bar.van-hairline--bottom > div.van-nav-bar__title.van-ellipsis'
     )
     assert tex == '登录'
示例#28
0
 def test_search_009(self):
     """测试--搜索历史--"""
     Login(self.wd).test_login002("13253728975", "123456w")
     Base(self.wd).ClickElement(By.XPATH,
                                '//*[@id="app"]/div[2]/div[2]/div[4]')
     time.sleep(1)
     Base(self.wd).ClickElement(By.XPATH,
                                '//*[@id="app"]/div[2]/div[1]/div[1]/div')
     print('点击输入框')
     time.sleep(2)
     Base(self.wd).sendKeys(By.CSS_SELECTOR, '.input-container>input',
                            '朝花夕拾')
     print('输入')
     time.sleep(1)
     # 点击搜索
     Base(self.wd).ClickElement(By.XPATH,
                                '//*[@id="app"]/div[2]/div[1]/div/span[2]')
     print('sou')
     time.sleep(2)
     Base(self.wd).ClickElement(
         By.CSS_SELECTOR,
         '#app div:nth-child(2) > div.search-input > div > span.cancel')
     time.sleep(1)
     Base(self.wd).ClickElement(By.XPATH,
                                '//*[@id="app"]/div[2]/div[1]/div[1]/div')
     # time.sleep(4)
     all = WebDriverWait(self.wd, 30, 1).until(lambda x: x.find_elements(
         By.CSS_SELECTOR, 'div.search-history > ul > li:nth-child(1) > span'
     ))
     all[0].click()
     time.sleep(1)
     text = Base(self.wd).text(By.CSS_SELECTOR, '.author')
     assert text == '鲁迅'
示例#29
0
 def test_main_005(self):
     "测试--‘我的’--页面底部显示"
     Login(self.wd).test_login002("13253728975", "123456w")
     Base(self.wd).ClickElement(By.XPATH, '//*[@id="app"]/div[2]/div[2]/div[5]')
     # 移动到页面底部
     self.wd.execute_script("window.scrollTo(0,document.body.scrollHeight)")
     time.sleep(2)
     try:
         print(5.11)
         yijian=Base(self.wd).text(By.XPATH,
                                    '//*[@id="app"]/div[2]/div[1]/div[3]/div[6]/div/span')
         assert yijian=="意见反馈"
         print(5.12)
     except:
         print(5.2)
         lishi=Base(self.wd).text(By.XPATH,
                                    '//*[@id="app"]/div[2]/div[1]/div[3]/div[3]/div/span')
         assert lishi=="阅读历史"
示例#30
0
 def test_main_004(self):
     """测试--‘我的’--页面是否能正常显示"""
     Login(self.wd).test_login002("13253728975", "123456w")
     Base(self.wd).ClickElement(By.XPATH,'//*[@id="app"]/div[2]/div[2]/div[5]')
     try:
         print(4.11)
         phoneNum=Base(self.wd).text(By.XPATH,
                                    '//*[@id="app"]/div[2]/div[1]/div[2]/div/div[1]/div[2]/div[1]/span[1]')
         js="$('.user-title-top>input').text('')"
         cc=self.wd.execute_script(js)
         print(cc)
         assert phoneNum=="13253728975"
         print(4.12)
     except:
         print(4.2)
         fx = Base(self.wd).text(By.XPATH,
                                       '//*[@id="app"]/div[2]/div[1]/div[3]/div[1]/div/span')
         assert fx=="我要分享"