Ejemplo n.º 1
0
    def test_login(self):
        username = '******'
        password = '******'

        loginService = Login()
        loginService.user_login(self.driver, username, password)
        self.driver.quit()
Ejemplo n.º 2
0
 def setUp(self):
     print("start"),
     self.browser = webdriver.Chrome()
     # self.browser = webdriver.Chrome(executable_path='/Users/xuzhen/chromedriver')
     sleep(3)
     Login.user_login(self.browser)
     sleep(5)
Ejemplo n.º 3
0
    def member_login(self, username, password):
        Login().user_login(self.driver, username, password)
        time.sleep(0.5)
        userinfo = self.driver.find_element_by_xpath("//div[@class = 'userName']").text
        #Login().user_logout(self.driver)

        return userinfo
Ejemplo n.º 4
0
def test_case2():
    dr = webdriver.Chrome()
    dr.maximize_window()
    dr.get("https://mail.126.com")
    lg = Login(dr)  # 实例化类
    lg.login("guest", "b678901")
    sleep(3)
    lg.close_browser()
Ejemplo n.º 5
0
def test_case1():
    dr = webdriver.Chrome()
    dr.maximize_window()
    dr.get("https://mail.126.com")
    lg = Login(dr)  # 实例化类
    lg.login("admin", "a123456")
    sleep(3)
    lg.close_browser()
Ejemplo n.º 6
0
    def test_recharge(self):
        driver = self.driver
        Login().login()

        # 进行充值
        driver.find_element_by_css_selector(".btn-charge").click()
        driver.find_element_by_xpath("//input[@name='amount']").send_keys(
            "997.32")

        # 用键盘的ENTER键代替鼠标的click事件
        driver.find_element_by_css_selector("[type='submit']").send_keys(
            Keys.ENTER)

        # 接受alert
        driver.switch_to_alert().accept()

        driver.find_element_by_link_text("发送验证码").click()
        driver.switch_to_alert().accept()
        driver.find_element_by_css_selector("[match='smsCode']").send_keys(
            "666666")
        driver.find_element_by_link_text("确认充值").click()
        driver.find_element_by_link_text("立即跳转").click()

        print(ctime())
Ejemplo n.º 7
0
import sys

start = time.process_time()
start_1 = time.perf_counter()

fp = open('package_log.txt','w')

sys.stderr = fp
sys.stdout = fp


driver = webdriver.Chrome()
driver.implicitly_wait(2)
driver.maximize_window()
driver.get('http://docker39-erp.qipeipu.net/#/login/10000')
Login().user_login(driver)
# account = driver.find_element_by_id('account')
# #输入账号
# account.send_keys('erp')
# pwd = driver.find_element_by_id('password')
# pwd.send_keys('123')
# #点击【登录】
# driver.find_element_by_class_name('btn-group').click()
# #弹出选择厂牌窗口,验证是否弹出,title=‘选择厂牌’

# time.sleep(1)
# #选择厂牌和点击确定
# driver.find_element_by_xpath('//div[@id="app"]/div[2]/div/div[3]/div/ul/li[1]/span').click()
# driver.find_element_by_xpath('//*[@id="app"]/div[2]/div/div[3]/div/div[2]/button').click()
# time.sleep(1)
#服务器错误的对话框
Ejemplo n.º 8
0
from selenium import webdriver
import time
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from public import Login

dr = webdriver.Firefox()
dr.get('https://www.126.com/')

#数据化驱动
usern = 'user'
passw = '1234'

l = Login(dr)
l.login(usern, passw)
Ejemplo n.º 9
0
 def test_guest_login(self):
     username = '******'
     password = '******'
     Login().user_login(self.driver, username, password)
Ejemplo n.º 10
0
from selenium import webdriver
from public import Login

driver=webdriver.Chrome()
driver.implicitly_wait(10)
driver.get("http://www.acmcoder.com/index")

loginService = Login()
#调用登陆模块
loginService.user_login(driver)
#调用退出模块
loginService.user_logout(driver)
Ejemplo n.º 11
0
from selenium import webdriver
from public import Login

b = webdriver.Firefox()
b.get("http://www.maiziedu.com")

Login().user_login(b)  #调用登录模块

Login().user_logout(b)  #调用退出模块git
Ejemplo n.º 12
0
 def test_admin_login(self):
     username = '******'
     password = '******'
     Login().user_login(self.driver, username, password)
Ejemplo n.º 13
0
    def test_Robot_session(self):
        '''机器人服务数据-机器人会话量'''
        driver = self.driver
        driver.get(self.base_url)
        username = '******'
        password = '******'
        Login().user_login(driver, username, password)
        time.sleep(2)
        print(driver.current_url)

        driver.find_element_by_xpath(
            '//*[@id="primaryNav"]/div[2]/div[1]/div/ul/li[2]/div/a/span[2]'
        ).click()
        time.sleep(2)
        print(driver.current_url)

        text_Robot_session = driver.find_element_by_xpath(
            '//*[@id="_content"]/div/div/div[1]/div/div[1]/div/div/div[2]'
        ).text
        print(text_Robot_session)
        self.assertEqual(text_Robot_session, '机器人会话量', msg="机器人会话量字段错误")
        text_Robot_session_data = driver.find_element_by_xpath(
            '//*[@id="_content"]/div/div/div[1]/div/div[1]/div/div/div[1]'
        ).text
        print(text_Robot_session_data)

        text_Robot_solution = driver.find_element_by_xpath(
            '//*[@id="_content"]/div/div/div[1]/div/div[2]/div/div[1]/div[2]'
        ).text
        print(text_Robot_solution)
        self.assertEqual(text_Robot_solution, '机器人解决量', msg="机器人解决量字段错误")
        text_Robot_solution_data = driver.find_element_by_xpath(
            '//*[@id="_content"]/div/div/div[1]/div/div[2]/div/div[1]/div[1]'
        ).text
        print(text_Robot_solution_data)
        text_Rttac = driver.find_element_by_xpath(
            '//*[@id="_content"]/div/div/div[1]/div/div[3]/div/div[1]/div[2]'
        ).text
        print(text_Rttac)
        self.assertEqual(text_Rttac, '机器人转人工会话量', msg="机器人转人工会话量字段错误")
        text_Rttac_data = driver.find_element_by_xpath(
            '//*[@id="_content"]/div/div/div[1]/div/div[3]/div/div[1]/div[1]'
        ).text
        print(text_Rttac_data)

        sa = int(text_Robot_solution_data) + int(text_Rttac_data)
        print('机器人解决量 + 机器人转人工会话量' + '=' + str(sa))
        self.assertEqual(int(text_Robot_session_data), sa, msg="数据矛盾")
        '''机器人解决率'''
        text_Rr = driver.find_element_by_xpath(
            '//*[@id="_content"]/div/div/div[1]/div/div[2]/div/div[2]').text
        print(text_Rr)
        text_Robot_resolution = text_Rr.split(':')[0]
        print(text_Robot_resolution)
        self.assertEqual(text_Robot_resolution, '机器人解决率', msg="机器人解决率字段错误")
        text_Robot_resolution_data1 = text_Rr.split(':')[1]
        print(text_Robot_resolution_data1)
        print(type(text_Robot_resolution_data1))
        text_Robot_resolution_data1 = ' '.join(
            text_Robot_resolution_data1.split())

        text_Robot_resolution_data2 = ('%.2f%%' %
                                       (int(text_Robot_solution_data) /
                                        int(text_Robot_session_data) * 100))
        print(text_Robot_resolution_data2)
        print(type(text_Robot_resolution_data2))

        self.assertEqual(text_Robot_resolution_data1,
                         text_Robot_resolution_data2,
                         msg="数据矛盾")
        '''机器人转人工率'''
        text_Rtr = driver.find_element_by_xpath(
            '//*[@id="_content"]/div/div/div[1]/div/div[3]/div/div[2]').text
        print(text_Rtr)
        text_Robot_transfer_rate = text_Rtr.split(':')[0]
        print(text_Robot_transfer_rate)
        self.assertEqual(text_Robot_transfer_rate, '机器人转人工率', msg="机器人解决率字段错误")
        text_Robot_transfer_rate_data1 = text_Rtr.split(':')[1]
        print(text_Robot_transfer_rate_data1)
        print(type(text_Robot_transfer_rate_data1))
        text_Robot_transfer_rate_data1 = ' '.join(
            text_Robot_transfer_rate_data1.split())

        text_Robot_transfer_rate_data2 = (
            '%.2f%%' %
            (int(text_Rttac_data) / int(text_Robot_session_data) * 100))
        print(text_Robot_transfer_rate_data2)
        print(type(text_Robot_transfer_rate_data2))

        self.assertEqual(text_Robot_transfer_rate_data1,
                         text_Robot_transfer_rate_data2,
                         msg="数据矛盾")

        float(text_Robot_transfer_rate_data1.strip('%')) + float(
            text_Robot_transfer_rate_data2.strip('%'))
        self.assertEqual(
            float(text_Robot_resolution_data1.strip('%')) / 100 +
            float(text_Robot_transfer_rate_data2.strip('%')) / 100,
            1,
            msg="数据矛盾")
Ejemplo n.º 14
0
 def test_admin_login(self):
     username = '******'
     password = '******'
     Login().user_login(self.driver, username, password)
     self.driver.quit()
Ejemplo n.º 15
0
from selenium import webdriver
from public import Login

driver = webdriver.Chrome()
driver.implicitly_wait(10)
driver.get("http://www.126.com")

# 调用登录模块
Login().user_login(driver)

# 收信、写信、删除信件等操作
# ……

# 调用退出模块
Login().user_logout(driver)
Ejemplo n.º 16
0
 def test_guest_login(self):
     username = '******'
     password = '******'
     Login().user_login(self.driver, username, password)
     self.driver.quit()
Ejemplo n.º 17
0
Archivo: run.py Proyecto: guozhanx/Demo
if __name__ == '__main__':
    #driver=webdriver.Firefox()
    driver = webdriver.Chrome()
    driver.maximize_window()
    driver.implicitly_wait(10)
    driver.get("http://prep.tingjiandan.com/bmp-web/login")
    suite = testsuit.suite(driver)

    now = time.strftime("%Y-%m-%d %H_%M_%S")
    filename = '../report/' + now + '_result.html'
    fp = open(filename, 'wb')
    #生成报告
    runner = HTMLTestRunner(
        stream=fp,
        title='集团管理自动化测试',  #报告title
        description='运行环境:MySQL(PyMySQL), Requests, unittest,selenium ')

    #调用登录,执行一次
    Login().user_login(driver)
    sleep(3)
    #打开集团管理,执行一次
    Login().OpenGroupManage(driver)
    sleep(3)
    #运行测试用例
    runner.run(suite)
    fp.close()

    #退出登录,执行一次
    '''
	Login().user_loginout(driver)'''
    driver.quit()
Ejemplo n.º 18
0
from selenium import webdriver
import time
from public import Login

driver = webdriver.Firefox()
driver.implicitly_wait(10)
driver.get("http://www.126.com")

Login().user_login(driver, "a724153792", "18795650445ya")

#收信,写信,删除信息等操作
time.sleep(5)

#退出
Login().user_logout(driver)
Ejemplo n.º 19
0
# encoding=utf-8
from selenium import webdriver
from public import Login

driver = webdriver.Firefox()
driver.get('http://www.126.com')

# 调用登录模块
Login.user_login()

# 写信,删除信,收信
# .................

# 调用退出模块
Login.user_logout()
Ejemplo n.º 20
0
 def test_zhoushan_login(self):
     username = "******"
     pwd = "123456"
     Login().user_login(self.b, username, pwd)
     self.b.quit()
Ejemplo n.º 21
0
 def test_asmin_login(self):
     username = "******"
     pwd = "123"
     Login().user_login(self.b, username, pwd)
     self.b.quit()