예제 #1
0
파일: zhuce.py 프로젝트: dangai0201/ecshop
class Zhuce():
    def __init__(self):
        self.driver = Login().driver

    def zhuce001(self):
        self.driver.find_element_by_xpath(
            "//*[@id=\"ECS_MEMBERZONE\"]/a[2]").click()
        time.sleep(2)
        pass

    def zhuce(self, name, email, password, password2, qq, bangong, jiating,
              shoujihao, wenti):
        self.driver.find_element_by_name("username").send_keys(name)
        self.driver.find_element_by_name("email").send_keys(email)
        self.driver.find_element_by_name("password").send_keys(password)
        self.driver.find_element_by_name("confirm_password").send_keys(
            password2)
        self.driver.find_element_by_name("extend_field2").send_keys(qq)
        self.driver.find_element_by_name("extend_field3").send_keys(bangong)
        self.driver.find_element_by_name("extend_field4").send_keys(jiating)
        self.driver.find_element_by_name("extend_field5").send_keys(shoujihao)
        self.driver.find_element_by_name("passwd_answer").send_keys(wenti)

    def question(self, a=None):
        if a != None:
            self.driver.find_element_by_name("sel_question").click()
            time.sleep(2)
            self.driver.find_element_by_xpath(
                "/html/body/div[3]/div[3]/div[1]/form/table/tbody/tr[10]/td[2]/select/option["
                + str(a) + "]").click()

    def submit(self):
        self.driver.find_element_by_name("Submit").click()
예제 #2
0
파일: denglu.py 프로젝트: dangai0201/ecshop
class DENGLU(unittest.TestCase):
    @classmethod
    def setUpClass(self):
        self.driver = Login().driver
        pass

    @classmethod
    def tearDownClass(self):
        Denglu().guanbi()
        pass

    def setUp(self):

        pass

    def tearDown(self):
        # 通过try进行判断有没有弹框
        try:
            Denglu().alert().accept()
        except Exception:
            # print u"没有弹框"
            pass
        self.driver.find_element_by_xpath(
            "//*[@id=\"ECS_MEMBERZONE\"]/a[2]").click()
        pass

    def test_001(self):
        # for aa in Duqucsv().duqucsv():
        #     b=self.driver.

        pass
예제 #3
0
class Tijiaodingdan():
    def __init__(self):
        self.driver = Login().driver

    def tijiaodingdan(self):
        self.driver.find_element_by_xpath(
            "//*[@id=\"theForm\"]/div[11]/div[2]/input[1]").click()

    def dingdanhao(self):
        a = self.driver.find_element_by_xpath(
            "/html/body/div[5]/div/h6/font").text
        return a
예제 #4
0
class Genrenxinxi():
    def __init__(self):
        self.driver = Login().driver

    def gerenxinxi(self):
        self.driver.find_element_by_xpath(
            "/html/body/div[1]/div[1]/div/div/a[1]").click()

    def zuixindingdan(self):
        self.driver.find_element_by_xpath(
            "/html/body/div[5]/div[1]/div/div/div/div/a[3]").click()
        a = self.driver.find_element_by_class_name("f6").text
        return a
예제 #5
0
class Denglu():
    def __init__(self):
        self.driver = Login().driver

    def denglu(self, a, b):
        self.driver.find_element_by_xpath(
            "//*[@id=\"ECS_MEMBERZONE\"]/a[1]").click()
        time.sleep(2)
        self.driver.find_element_by_name("username").send_keys(a)
        self.driver.find_element_by_name("password").send_keys(b)
        self.driver.find_element_by_name("submit").click()

    def alert(self):
        return self.driver.switch_to.alert

    def guanbi(self):
        self.driver.quit()
예제 #6
0
class Gouwuche():
    def __init__(self):
        self.driver = Login().driver

    def xiugai1(self):
        self.driver.find_elements_by_class_name("f6")[0].click()

    def xiugai2(self, mingzi, dizhi, tel, email, youbian, shoujihao):
        self.driver.find_elements_by_name("f6")[1].click()
        self.driver.find_element_by_name("consignee").send_keys(mingzi)
        self.driver.find_element_by_name("address").send_keys(dizhi)
        self.driver.find_element_by_name("tel").send_keys(tel)
        self.driver.find_element_by_name("email").send_keys(email)
        self.driver.find_element_by_name("zipcode").send_keys(youbian)
        self.driver.find_element_by_name("mobile").send_keys(shoujihao)
        self.driver.find_elements_by_class_name("bnt_blue_2")[0].click()

    def shiyongyue(self, a):
        self.driver.find_element_by_name("surplus").send_keys(a)

    def shiyongjifen(self, a):
        self.driver.find_element_by_name("integral").send_keys(a)

    def shiyonghongbao(self, a):
        self.driver.find_element_by_name("bonus_sn").send_keys(a)
        self.driver.find_element_by_name("validate_bonus").click()

    def dingdanfuyan(self, a):
        self.driver.find_element_by_name("postscript").send_keys(a)

    def peisongshifou(self):
        self.driver.find_element_by_name("need_insure").click()

    def tijiaodingdan(self):
        self.driver.find_element_by_xpath(
            "//*[@id=\"theForm\"]/div[11]/div[2]/input[1]").click()
예제 #7
0
파일: gouwuche.py 프로젝트: dangai0201/da
class Gouwuche():
    def __init__(self):
        self.driver = Login().driver

    def shangpinmingcheng(self):
        a = self.driver.find_element_by_xpath(
            "//*[@id=\"formCart\"]/table[1]/tbody/tr[2]/td[1]/a[2]").text
        return a

    def shichangjia(self):
        a = self.driver.find_element_by_xpath(
            "//*[@id=\"formCart\"]/table[1]/tbody/tr[2]/td[3]").text
        return a

    def bendianjia(self):
        a = self.driver.find_element_by_xpath(
            "//*[@id=\"formCart\"]/table[1]/tbody/tr[2]/td[4]").text
        return a

    def xiugaishuliang(self, a):
        self.driver.find_elements_by_class_name("inputBg")[0].clear()
        self.driver.find_elements_by_class_name("inputBg")[0].send_keys(a)

    def dianjishanchu(self):
        self.driver.find_element_by_xpath(
            "//*[@id=\"formCart\"]/table[1]/tbody/tr[2]/td[7]/a[1]").click()

    def dianjifangrugouwuche(self):
        self.driver.find_element_by_xpath(
            "//*[@id=\"formCart\"]/table[1]/tbody/tr[2]/td[7]/a[2]")

    def qingkonggouwuche(self):
        self.driver.find_elements_by_class_name("bnt_blue_1")[0].click()

    def gengxingouwuche(self):
        self.driver.find_elements_by_class_name("bnt_blue_1")[1].click()

    def dianjijiesuan(self):
        self.driver.find_element_by_xpath(
            "/html/body/div[5]/div[1]/table/tbody/tr/td[2]/a/img").click()

    def dianjijixugouwu(self):
        self.driver.find_element_by_xpath(
            "/html/body/div[5]/div[1]/table/tbody/tr/td[1]/a/img").click()
예제 #8
0
class DENGLU(unittest.TestCase):
    @classmethod
    def setUpClass(self):
        self.driver = Login().driver
        pass

    @classmethod
    def tearDownClass(self):
        Denglu().guanbi()
        pass

    def setUp(self):

        pass

    def tearDown(self):
        # 通过try进行判断有没有弹框
        try:
            Denglu().alert().accept()
        except Exception:
            # print u"没有弹框"
            pass
        self.driver.find_element_by_xpath(
            "//*[@id=\"ECS_MEMBERZONE\"]/a[2]").click()
        pass

    def test_001(self):
        i = "1"
        print "test00" + i
        username = Duqu().duqu("lianxi", "denglu001", "username")
        password = Duqu().duqu("lianxi", "denglu001", "password")
        yuqi = Duqu().duqu("lianxi", "denglu001", "yuqi")
        if username == " ":
            username = ""
        if password == " ":
            password = ""
        Denglu().denglu(username, password)
        a = Denglu().alert()
        #a = self.driver.find_element_by_xpath("/html/body/div[4]/div/div/div/div/p[1]")
        shiji = a.text
        print shiji
        self.assertIn(yuqi, shiji, msg=u"断言失败")
        pass

    def test_002(self):
        i = "2"
        print "test00" + i
        username = Duqu().duqu("lianxi", "denglu00" + i, "username")
        password = Duqu().duqu("lianxi", "denglu00" + i, "password")
        yuqi = Duqu().duqu("lianxi", "denglu00" + i, "yuqi")
        if username == " ":
            username = ""
        if password == " ":
            password = ""
        Denglu().denglu(username, password)
        a = Denglu().alert()
        #a = self.driver.find_element_by_xpath("/html/body/div[4]/div/div/div/div/p[1]")
        shiji = a.text
        print shiji
        self.assertIn(yuqi, shiji, msg=u"断言失败")
        pass

    def test_003(self):
        i = "3"
        print "test00" + i
        username = Duqu().duqu("lianxi", "denglu00" + i, "username")
        password = Duqu().duqu("lianxi", "denglu00" + i, "password")
        yuqi = Duqu().duqu("lianxi", "denglu00" + i, "yuqi")
        if username == " ":
            username = ""
        if password == " ":
            password = ""
        Denglu().denglu(username, password)
        #a = Denglu().alert()
        a = self.driver.find_element_by_xpath(
            "/html/body/div[4]/div/div/div/div/p[1]")
        shiji = a.text
        print shiji
        self.assertIn(yuqi, shiji, msg=u"断言失败")
        pass

    def test_004(self):
        i = "4"
        print "test00" + i
        username = Duqu().duqu("lianxi", "denglu00" + i, "username")
        password = Duqu().duqu("lianxi", "denglu00" + i, "password")
        yuqi = Duqu().duqu("lianxi", "denglu00" + i, "yuqi")
        if username == " ":
            username = ""
        if password == " ":
            password = ""
        Denglu().denglu(username, password)
        #a = Denglu().alert()
        a = self.driver.find_element_by_xpath(
            "/html/body/div[4]/div/div/div/div/p[1]")
        shiji = a.text
        print shiji
        self.assertIn(yuqi, shiji, msg=u"断言失败")
        pass

    def test_005(self):
        i = "5"
        print "test00" + i
        username = Duqu().duqu("lianxi", "denglu00" + i, "username")
        password = Duqu().duqu("lianxi", "denglu00" + i, "password")
        yuqi = Duqu().duqu("lianxi", "denglu00" + i, "yuqi")
        if username == " ":
            username = ""
        if password == " ":
            password = ""
        Denglu().denglu(username, password)
        #a = Denglu().alert()
        a = self.driver.find_element_by_xpath(
            "/html/body/div[4]/div/div/div/div/p[1]")
        shiji = a.text
        print shiji
        self.assertIn(yuqi, shiji, msg=u"断言失败")
        pass

    def test_010(self):
        i = "10"
        print "test0" + i
        username = Duqu().duqu("lianxi", "denglu0" + i, "username")
        password = Duqu().duqu("lianxi", "denglu0" + i, "password")
        yuqi = Duqu().duqu("lianxi", "denglu0" + i, "yuqi")
        if username == " ":
            username = ""
        if password == " ":
            password = ""
        Denglu().denglu(username, password)
        #a = Denglu().alert()
        a = self.driver.find_element_by_xpath(
            "/html/body/div[4]/div/div/div/div/p[1]")
        shiji = a.text
        print shiji
        self.assertIn(yuqi, shiji, msg=u"断言失败")
        pass
예제 #9
0
파일: gouwuche.py 프로젝트: dangai0201/da
class Gouwuche():
    def __init__(self):
        self.driver=Login().driver
    def dianjijiesuan(self):
        time.sleep(2)
        self.driver.find_element_by_xpath("/html/body/div[5]/div[1]/table/tbody/tr/td[2]/a/img").click()
예제 #10
0
파일: denglu.py 프로젝트: dangai0201/da
class DENGLU(unittest.TestCase):
    @classmethod
    def setUpClass(self):
        self.driver = Login().driver
        pass

    @classmethod
    def tearDownClass(self):
        Denglu().guanbi()
        pass

    def setUp(self):

        pass

    def tearDown(self):
        # 通过try进行判断有没有弹框
        try:
            Denglu().alert().accept()
        except Exception:
            # print u"没有弹框"
            pass
        self.driver.find_element_by_xpath("//*[@id=\"ECS_MEMBERZONE\"]/a[2]").click()
        pass


    def test_001(self):
        i="2"
        username = Huoquexel().duquexel("C"+i)
        password = Huoquexel().duquexel("D"+i)
        yuqi = Huoquexel().duquexel("E"+i)
        #判断是否有空
        if username == " ":
            username=""
        if password==" ":
            password=""
        Denglu().denglu(username, password)
        a = Denglu().alert()
        #a = self.driver.find_element_by_xpath("/html/body/div[4]/div/div/div/div/p[1]")
        shiji = a.text
        print (shiji)
        Huoquexel().xieruexel("F"+i,shiji)
        Huoquexel().xieruexel("H"+i,time1)
        self.assertIn(yuqi, shiji, msg=u"断言失败")
        pass
    def test_002(self):
        i="3"
        username = Huoquexel().duquexel("C"+i)
        password = Huoquexel().duquexel("D"+i)
        yuqi = Huoquexel().duquexel("E"+i)
        if username == " ":
            username=""
        if password==" ":
            password=""
        Denglu().denglu(username, password)
        a = Denglu().alert()
        #a = self.driver.find_element_by_xpath("/html/body/div[4]/div/div/div/div/p[1]")
        shiji = a.text
        print (shiji)
        Huoquexel().xieruexel("F" + i, shiji)
        Huoquexel().xieruexel("H" + i, time1)
        self.assertIn(yuqi, shiji, msg=u"断言失败")
        pass
    def test_003(self):
        i="4"
        username = Huoquexel().duquexel("C"+i)
        password = Huoquexel().duquexel("D"+i)
        yuqi = Huoquexel().duquexel("E"+i)
        Denglu().denglu(username, password)
        #a = Denglu().alert()
        a = self.driver.find_element_by_xpath("/html/body/div[4]/div/div/div/div/p[1]")
        shiji = a.text
        print (shiji)
        Huoquexel().xieruexel("F" + i, shiji)
        Huoquexel().xieruexel("H" + i, time1)
        self.assertIn(yuqi, shiji, msg=u"断言失败")
        pass
    def test_004(self):
        i="5"
        username = Huoquexel().duquexel("C"+i)
        password = Huoquexel().duquexel("D"+i)
        yuqi = Huoquexel().duquexel("E"+i)
        Denglu().denglu(username, password)
        #a = Denglu().alert()
        a = self.driver.find_element_by_xpath("/html/body/div[4]/div/div/div/div/p[1]")
        shiji = a.text
        print (shiji)
        Huoquexel().xieruexel("F" + i, shiji)
        Huoquexel().xieruexel("H" + i, time1)
        self.assertIn(yuqi, shiji, msg=u"断言失败")
        pass

    def test_005(self):
        i="6"
        username = Huoquexel().duquexel("C"+i)
        password = Huoquexel().duquexel("D"+i)
        yuqi = Huoquexel().duquexel("E"+i)
        Denglu().denglu(username, password)
        #a = Denglu().alert()
        a = self.driver.find_element_by_xpath("/html/body/div[4]/div/div/div/div/p[1]")
        shiji = a.text
        print (shiji)
        Huoquexel().xieruexel("F" + i, shiji)
        Huoquexel().xieruexel("H" + i, time1)
        self.assertIn(yuqi, shiji, msg=u"断言失败")
        pass
예제 #11
0
class DENGLU(unittest.TestCase):
    @classmethod
    def setUpClass(self):
        self.driver = Login().driver
        pass

    @classmethod
    def tearDownClass(self):
        #Denglu().guanbi()
        pass

    def setUp(self):

        pass

    def tearDown(self):
        # 通过try进行判断有没有弹框
        # try:
        #     Denglu().alert().accept()
        # except Exception:
        #     #print u"没有弹框"
        #     pass
        # self.driver.find_element_by_xpath("//*[@id=\"ECS_MEMBERZONE\"]/a[2]").click()
        pass

    # def test_001(self):
    #
    #     Denglu().denglu("", "")
    #     a = Denglu().alert()
    #     shiji = a.text
    #     # print (shiji)
    #     yuqi = u"用户名不能为空"
    #     self.assertIn(yuqi, shiji, msg=u"断言失败")
    #     Denglu().alert().accept()
    #
    #     pass
    #
    # def test_002(self):
    #     Denglu().denglu("123456", "")
    #     a = Denglu().alert()
    #     shiji = a.text
    #     # print (shiji)
    #     yuqi = u"登录密码不能为空"
    #     self.assertIn(yuqi, shiji, msg=u"断言失败")
    #     Denglu().alert().accept()
    #     pass
    #
    # def test_003(self):
    #     Denglu().denglu("123456", "123123123")
    #     shiji = self.driver.find_element_by_xpath("/html/body/div[4]/div/div/div/div/p[1]").text
    #     print (shiji)
    #     yuqi = u"用户名或密码错误"
    #     self.assertEqual(yuqi, shiji)
    #
    #     pass
    #
    # # 长度空
    # def test_005(self):
    #     Denglu().denglu(" ", "123456")
    #     shiji = self.driver.find_element_by_xpath("/html/body/div[4]/div/div/div/div/p[1]").text
    #     print (shiji)
    #     yuqi = u"用户名或密码错误"
    #     self.assertEqual(yuqi, shiji)
    #     pass
    #
    # # 长度3
    # def test_006(self):
    #     Denglu().denglu("988", "123456")
    #     shiji = self.driver.find_element_by_xpath("/html/body/div[4]/div/div/div/div/p[1]").text
    #     print (shiji)
    #     yuqi = u"用户名或密码错误"
    #     self.assertEqual(yuqi, shiji)
    #     pass
    #
    # # 长度14
    # def test_007(self):
    #     Denglu().denglu("12345678912345", "123456")
    #     shiji = self.driver.find_element_by_xpath("/html/body/div[4]/div/div/div/div/p[1]").text
    #     print (shiji)
    #     yuqi = u"用户名或密码错误"
    #     self.assertEqual(yuqi, shiji)
    #     pass
    #
    # # 长度2
    # def test_008(self):
    #     Denglu().denglu("12", "123456")
    #     shiji = self.driver.find_element_by_xpath("/html/body/div[4]/div/div/div/div/p[1]").text
    #     print (shiji)
    #     yuqi = u"用户名或密码错误"
    #     self.assertEqual(yuqi, shiji)
    #     pass
    #
    # # 长度15
    # def test_009(self):
    #     Denglu().denglu("123456789123456", "123456")
    #     shiji = self.driver.find_element_by_xpath("/html/body/div[4]/div/div/div/div/p[1]").text
    #     print (shiji)
    #     yuqi = u"用户名或密码错误"
    #     self.assertEqual(yuqi, shiji)
    #     pass
    #
    # # 类型:汉字
    # def test_010(self):
    #     Denglu().denglu(u"你好", "123456")
    #     shiji = self.driver.find_element_by_xpath("/html/body/div[4]/div/div/div/div/p[1]").text
    #     print (shiji)
    #     yuqi = u"用户名或密码错误"
    #     self.assertEqual(yuqi, shiji)
    #     pass
    #
    # # 类型:字母
    # def test_0011(self):
    #     Denglu().denglu("abd", "123456")
    #     shiji = self.driver.find_element_by_xpath("/html/body/div[4]/div/div/div/div/p[1]").text
    #     print (shiji)
    #     yuqi = u"用户名或密码错误"
    #     self.assertEqual(yuqi, shiji)
    #     pass
    #
    # # 类型:数字
    # # 类型:特殊字符
    # def test_012(self):
    #     Denglu().denglu(u"????", "123456")
    #     shiji = self.driver.find_element_by_xpath("/html/body/div[4]/div/div/div/div/p[1]").text
    #     print (shiji)
    #     yuqi = u"用户名或密码错误"
    #     self.assertEqual(yuqi, shiji)
    #     pass
    #
    # # #组合
    # # 大小写
    # def test_013(self):
    #     Denglu().denglu("abcASSS", "123456")
    #     shiji = self.driver.find_element_by_xpath("/html/body/div[4]/div/div/div/div/p[1]").text
    #     print (shiji)
    #     yuqi = u"用户名或密码错误"
    #     self.assertEqual(yuqi, shiji)
    #     pass
    #
    # # 空格
    # def test_014(self):
    #     Denglu().denglu("abcASS S", "123456")
    #     shiji = self.driver.find_element_by_xpath("/html/body/div[4]/div/div/div/div/p[1]").text
    #     print (shiji)
    #     yuqi = u"用户名或密码错误"
    #     self.assertEqual(yuqi, shiji)
    #     pass
    #
    # # 密码长度
    # # 前中后去空格别的同用户名输入框
    # # 前空格
    # def test_015(self):
    #     Denglu().denglu("  abcASSS", "123456")
    #     shiji = self.driver.find_element_by_xpath("/html/body/div[4]/div/div/div/div/p[1]").text
    #     print (shiji)
    #     yuqi = u"用户名或密码错误"
    #     self.assertEqual(yuqi, shiji)
    #     pass
    #
    # # 中空格
    # def test_016(self):
    #     Denglu().denglu("abc ASSS", "123456")
    #     shiji = self.driver.find_element_by_xpath("/html/body/div[4]/div/div/div/div/p[1]").text
    #     print (shiji)
    #     yuqi = u"用户名或密码错误"
    #     self.assertEqual(yuqi, shiji)
    #     pass
    #
    # # 后空格
    # def test_017(self):
    #     Denglu().denglu("abcASSS    ", "123456")
    #     try:
    #         a=Denglu().alert()
    #     except Exception:
    #         a=self.driver.find_element_by_xpath("/html/body/div[4]/div/div/div/div/p[1]")
    #     #return后代码不会向下执行
    #     #return a
    #     shiji=a.text
    #     print (shiji)
    #     yuqi = u"用户名或密码错误"
    #     self.assertEqual(yuqi, shiji)
    #     pass
    #
    # def test_004(self):
    #     Denglu().denglu("123456", "123456")
    #     shiji = self.driver.find_element_by_xpath("/html/body/div[4]/div/div/div/div/p[1]").text
    #     print (shiji)
    #     yuqi = u"登录成功"
    #     self.assertEqual(yuqi, shiji)
    #     # self.driver.find_element_by_xpath("//*[@id=\"ECS_MEMBERZONE\"]/a[2]").click()
    #     pass
    def test_018(self):
        Denglu().denglu("123456", "123456")
        self.driver.find_element_by_xpath(
            "/html/body/div[4]/div/div/div/div/p[2]/a").click()