示例#1
0
 def test_person_email_ok(self):  #个人邮件地址输入框
     input = Cloud(self.driver)  # input变量可以调用Cloud得方法
     url = "http://invoice.sunmi.com/?orderSn=AUTOtest0000000008"
     input.open(url)
     time.sleep(2)
     # 切换到个人开票
     #//*[@id="root"]/div/div/div[2]/div/div/div[3]/div[1]/div/form/div[2]/div/div/span/span  个人
     #//*[@id="root"]/div/div/div[2]/div/div/div[3]/div[2]/div[2]/form/div[3]/div/div/span/span 企业
     input.click(
         'xpath',
         '//*[@id="root"]/div/div/div[2]/div/div/div[1]/div/div/div/div/div[1]/div[1]'
     )
     # 清除当前输入框的值
     input.clear(
         'xpath',
         '//div[3]/div[1]/div[2]/form/div[2]/div/div/span/span/input')
     input.send_keys(
         'xpath',
         '//div[3]/div[1]/div[2]/form/div[2]/div/div/span/span/input',
         '*****@*****.**')
     # 再次捕获个人邮箱输入值
     a = input.Get_attribute(
         'xpath',
         '//*[@id="root"]/div/div/div[2]/div/div/div[3]/div[1]/div[2]/form/div[2]/div/div/span/span/input',
         'value')
     try:
         assert "*****@*****.**" == a
         print('Test Pass.')
     except Exception as e:
         input.get_windows_img()  # 调用基类截图方法
         print('Test Fail.', format(e))
示例#2
0
 def test_person_name_ok(self):  #个人姓名输入框
     input = Cloud(self.driver)  # input变量可以调用Cloud得方法
     url = "http://invoice.sunmi.com/?orderSn=AUTOtest0000000008"
     input.open(url)
     time.sleep(2)
     #//*[@id="root"]/div/div/div[2]/div/div/div[3]/div[1]/div[2]/form/div[1]/div/div/span/span 个人
     #//*[@id="root"]/div/div/div[2]/div/div/div[3]/div[2]/div[2]/form/div[1]/div/div/span/div/div/span 企业
     #切换到个人开票
     input.click(
         'xpath',
         '//*[@id="root"]/div/div/div[2]/div/div/div[1]/div/div/div/div/div[1]/div[1]'
     )
     #捕获个人开票默认值
     a = input.Get_attribute('css_selector', 'input[id="buyerName"]',
                             'value')
     input.clear('css_selector', 'input[id="buyerName"]')
     input.send_keys('css_selector', 'input[id="buyerName"]', '吴进城')
     #再次捕获个人姓名输入值
     b = input.Get_attribute('css_selector', 'input[id="buyerName"]',
                             'value')
     try:
         assert "个人" == a
         assert "吴进城" == b
         print('Test Pass.')
     except Exception as e:
         input.get_windows_img()  # 调用基类截图方法
         print('Test Fail.', format(e))
示例#3
0
 def test_person_phone(self):  #个人手机号输入框
     input = Cloud(self.driver)  # input变量可以调用Cloud得方法
     url = "http://invoice.sunmi.com/?orderSn=AUTOtest0000000008"
     input.open(url)
     time.sleep(2)
     # 切换到个人开票
     input.click(
         'xpath',
         '//*[@id="root"]/div/div/div[2]/div/div/div[1]/div/div/div/div/div[1]/div[1]'
     )
     #//*[@id="root"]/div/div/div[2]/div/div/div[3]/div[2]/div[2]/form/div[4]/div/div[2]/div/div[1]/div/div/span/span 企业
     #//*[@id="root"]/div/div/div[2]/div/div/div[3]/div[1]/div[2]/form/div[3]/div/div/span/span   个人
     #清空手机号输入框
     input.clear(
         'xpath',
         '//div[3]/div[1]/div[2]/form/div[3]/div/div/span/span/input')
     #输入手机号
     input.send_keys(
         'xpath',
         '//div[3]/div[1]/div[2]/form/div[3]/div/div/span/span/input',
         '13356788888')
     #获取手机号
     a = input.Get_attribute(
         'xpath',
         '//div[3]/div[1]/div[2]/form/div[3]/div/div/span/span/input',
         'value')
     try:
         assert "13356788888" == a
         print('Test Pass.')
     except Exception as e:
         input.get_windows_img()  # 调用基类截图方法
         print('Test Fail.', format(e))
示例#4
0
    def test_person_clear(self):  #个人清空按钮
        input = Cloud(self.driver)  # input变量可以调用Cloud得方法
        url = "http://invoice.sunmi.com/?orderSn=AUTOtest0000000008"
        input.open(url)
        time.sleep(2)
        # 切换到个人开票
        input.click(
            'xpath',
            '//*[@id="root"]/div/div/div[2]/div/div/div[1]/div/div/div/div/div[1]/div[1]'
        )
        #输入数据
        input.clear('css_selector', 'input[id="buyerName"]')
        input.send_keys('css_selector', 'input[id="buyerName"]', '吴进城')
        input.clear(
            'xpath',
            '//div[3]/div[1]/div[2]/form/div[2]/div/div/span/span/input')
        input.send_keys(
            'xpath',
            '//div[3]/div[1]/div[2]/form/div[2]/div/div/span/span/input',
            '*****@*****.**')
        input.clear(
            'xpath',
            '//div[3]/div[1]/div[2]/form/div[3]/div/div/span/span/input')
        # 输入手机号
        input.send_keys(
            'xpath',
            '//div[3]/div[1]/div[2]/form/div[3]/div/div/span/span/input',
            '13356788888')
        #点击清空按钮
        input.click('xpath', '//div[3]/div[1]/div[2]/form/button')

        #//*[@id="root"]/div/div/div[2]/div/div/div[3]/div[2]/div[2]/button 企业清空
        a = input.Get_attribute('css_selector', 'input[id="buyerName"]',
                                'value')
        b = input.Get_attribute('xpath',
                                '//form/div[2]/div/div/span/span/input',
                                'value')
        c = input.Get_attribute('xpath',
                                '//form/div[3]/div/div/span/span/input',
                                'value')
        try:
            assert "" == a
            assert "" == b
            assert "" == c
            print('Test Pass.')
        except Exception as e:
            input.get_windows_img()  # 调用基类截图方法
            print('Test Fail.', format(e))