Exemplo n.º 1
0
 def setUp(self) -> None:  # 前置条件
     self.br = SeleniumFramework()
     self.br.Open_url(Robot_url)
     # 登录
     self.br.Write('css=input[placeholder="用户名"]', 'admin')
     self.br.Write('css=input[placeholder="密码"]', 'adminadmin')
     self.br.Click('xpath=//button[contains(.,"登录")]')
     # 展开菜单
     self.br.Click('xpath=/html/body/div[1]/header/button[2]')
     self.br.Click('xpath=//li[contains(.," 系统管理")]')
     self.br.Click('css=a[href="#/sys/officeConfig"]')
Exemplo n.º 2
0
def robot():
    data = ReadExcel("RobotCodeData.xls").ReadRowsTable("name=Sheet1")
    print(data)
    br = SeleniumFramework()
    br.Open_url('https://www.baidu.com/')
    for i in data:
        elestring = i[0]
        staing = i[1]
        action = i[2]
        if action == 'write':
            br.Write(elestring, staing)
        elif action == 'click':
            br.Click(elestring)
        elif action == 'clear':
            br.Clear(elestring)
        elif action == 'text_up':
            br.Text_up(elestring)
        else:
            print("其他行为暂时没有做出来,敬请期待!!!")
    br.Out()
Exemplo n.º 3
0
 def test_login_001(self):  # 测试用例
     '''第一次登录上传位置'''
     # login
     driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub', desired_caps)
     driver.find_element_by_id(
         "com.example.administrator.websc:id/et_login_account").send_keys(
             "robot01")
     driver.find_element_by_id(
         "com.example.administrator.websc:id/et_login_password").send_keys(
             "123456")
     driver.find_element_by_id(
         "com.example.administrator.websc:id/btn_login").click()
     ExpectedResult = time.time()  #获取当前时间戳
     # #后台查询
     br = SeleniumFramework()
     br.Open_url(url)
     #     #login
     br.Write('css=input[placeholder="用户名"]', user)
     br.Write('css=input[placeholder="密码"]', psw)
     br.Click('css=button[class="btn btn-primary px-4"]')
     #     #展开菜单-->机器人管理-->位置管理
     br.Click(
         'css=button[class="navbar-toggler sidebar-toggler d-md-down-none"]'
     )
     br.Click('xpath=//li[contains(.," 机器人管理")]')
     br.Click('css=a[href="#/device/robotPosition"]')
     #     #点击机构
     # br.Click('xpath=//li[contains(.,u"MIR医院D")]')
     #     #获取时间
     ActualResult = br.Text_up(
         'xpath=/html/body/div[1]/div/main/div/div/div[1]/div[2]/div/div[2]/table/tbody/tr[1]/td[7]/span'
     )
     print(ActualResult)
     if int(TimeTranslate(ActualResult)) - int(ExpectedResult) < 30:
         self.assertEqual(1, 1, '对比结果不一致')
     else:
         self.assertEqual(1, 2, '对比结果不一致')
Exemplo n.º 4
0
 def setUp(self) -> None:  # 前置条件
     # Clear_environment()  # 清理web环境
     self.br = SeleniumFramework('wap', 'ge')
     self.br.Open_url(url)
Exemplo n.º 5
0
 def setUp(self) -> None:  # 前置条件
     # Clear_environment()  # 清理web环境
     print(Data)
     self.br = SeleniumFramework()
     self.br.Open_url(Robot_url)
Exemplo n.º 6
0
password = '******'
#后台管理
Robot_url = 'http://logistics-admin-test.epsit.cn:6066/#/auth/login?redirect=%2Fdashboard'  #测试环境

#添加用户
Institutions = '图片测试'
RobotUserName = '******'
RobotUserPassword = '******'
RobotUserNickname = 'QWER'

if __name__ == '__main__':
    from Auto_testing_comm_platform.Comm.SeleniumFramework import *
    from Auto_testing_comm_platform.Comm.Appium import *
    from Auto_testing_comm_platform.Comm.Base import *
    # #后台查询
    br = SeleniumFramework()
    br.Open_url(
        'http://logistics-admin-test.epsit.cn:6066/#/auth/login?redirect=%2Fdashboard'
    )
    #     #login
    br.Write('css=input[placeholder="用户名"]', 'admin')
    br.Write('css=input[placeholder="密码"]', 'adminadmin')
    br.Click('css=button[class="btn btn-primary px-4"]')
    #     #展开菜单-->机器人管理-->位置管理
    br.Click(
        'css=button[class="navbar-toggler sidebar-toggler d-md-down-none"]')
    br.Click('xpath=//li[contains(.," 机器人管理")]')
    br.Click('css=a[href="#/device/robotPosition"]')
    #     #点击机构
    # br.Click('xpath=//li[contains(.,u"MIR医院D")]')
    #     #获取时间
Exemplo n.º 7
0
import time

from Auto_testing_comm_platform.Comm.SeleniumFramework import *

br = SeleniumFramework(br_name='ge')
br.Open_url('http://logistics-admin-test.epsit.cn:6066/#/auth/login')
# 登录
br.Write('css=input[placeholder="用户名"]', 'admin')
br.Write('css=input[placeholder="密码"]', 'adminadmin')
br.Click('xpath=//button[contains(.,"登录")]')
# 展开菜单
br.Click('xpath=/html/body/div[1]/header/button[2]')
br.Click('xpath=//li[contains(.," 运行监控管理")]')
br.Click('css=a[href="#/run/monitorStatus"]')
# 添加配置

for i in range(1, 28):
    br.Click('css=button[class="ivu-btn ivu-btn-success"][title="增加"]')
    br.Click('xpath=//label[text()="所属机构"]/../div/div/div/span')
    br.Click('xpath=//label[text()="所属机构"]/../div/div/div[2]/ul[2]/li[14]')
    time.sleep(0.5)
    br.Click('xpath=//span[contains(.,"输入机器人状态")]')
    status = br.Text_up(
        'xpath=//label[text()="机器人状态"]/../div/div/div[2]/ul[2]/li[%s]' % i)
    br.Click('xpath=//label[text()="机器人状态"]/../div/div/div[2]/ul[2]/li[%s]' %
             i)
    print(status)
    br.Write('css=input[placeholder="输入异常状态时间间隔"]', '60')
    br.Write('css=input[placeholder="输入异常推送次数"]', '1')
    br.Click('xpath=//span[text()="选择预警级别"]')
    br.Click('xpath=//li[text()="高"]')
Exemplo n.º 8
0
import os, time
from Auto_testing_comm_platform.Comm.SeleniumFramework import *
from Auto_testing_comm_platform.Config.test_epsit import *

# 登录
br = SeleniumFramework('ge')
br.Open_url(Robot_url)
br.Write('css=input[placeholder="用户名"]', Robot_user)
br.Write('css=input[placeholder="密码"]', Robot_password)
br.Click('css=button[class="btn btn-primary px-4"]')
# 点击首页
br.Click('css=a[href="#/"]')
# 点击菜单
br.Click('css=button[class="navbar-toggler sidebar-toggler d-md-down-none"]')
# 进入系统管理--》机构配置管理
br.Click('xpath=//li[contains(.," 系统管理")]')
br.Click('css=a[href="#/sys/officeConfig"]')
# 选择云迹Y1医院D1
br.Click('xpath=//span[contains(.,"云迹Y1医院D1")]')
# 点击修改
br.Click('css=[class="fa fa-pencil-square-o text-primary"]')
# 找到运行模式
br.Click('xpath=//label[contains(.,"运行模式")]/../div/div')
br.Click('xpath=//label[contains(.,"运行模式")]/../div/div/div[2]/ul[2]/li[2]')
time.sleep(0.5)
# 配置安全距离和危险距离
br.Write('css=input[placeholder="输入安全距离 "]', '4')
br.Write('css=input[placeholder="输入危险距离"]', '3')
time.sleep(0.5)
# 点击提交
br.Click('css=button[class="ivu-btn ivu-btn-info"]')