def test_czrz(self): deng_lu = Deng_lu(self.dr) deng_lu.denglu() sleep(3) # 点击操作日志 self.dr.find_element_by_xpath( '//*[@id="admin-menus-box"]/div/div[8]/span').click() sleep(3) a = Select( self.dr.find_element_by_xpath( '//*[@id="pageShow"]/div[2]/select')) # 定位下拉框 a.select_by_visible_text("admin【】") # 文本定位 self.dr.find_element_by_xpath('//*[@id="startTime"]').send_keys( '2020-08-05') self.dr.find_element_by_xpath('//*[@id="endTime"]').send_keys( '2020-08-07') self.dr.find_element_by_xpath( '//*[@id="pageShow"]/div[2]/button').click() sleep(4) # 设置目标为某个元素,我使用xpath的定位方法 target = self.dr.find_element_by_xpath( '//*[@id="pageShow"]/div[3]/table/tbody/tr[16]/td[2]/button') # 滚动到目标位置 self.dr.execute_script("arguments[0].scrollIntoView();", target) self.dr.find_element_by_xpath( '//*[@id="pageShow"]/div[3]/table/tbody/tr[15]/td[1]/img[2]' ).click() self.dr.find_element_by_xpath( '//*[@id="pageShow"]/div[3]/table/tbody/tr[16]/td[2]/button' ).click() self.dr.find_element_by_class_name('layui-layer-btn1').click() sleep(4) self.dr.find_element_by_class_name('layui-laypage-next').click()
def test_zdtj(self): deng_lu = Deng_lu(self.dr) deng_lu.denglu() sleep(3) self.dr.find_element_by_xpath('//*[@id="admin-menus-box"]/div/div[6]/span').click() self.dr.find_element_by_xpath('//*[@id="admin-menus-box"]/div/div[6]/div/div[1]').click() sleep(3) self.dr.find_element_by_id('begin1').click() self.dr.find_element_by_id('begin1').clear() self.dr.find_element_by_id('begin1').send_keys('2020-06-10 00:00:00') sleep(2) self.dr.find_element_by_xpath('//*[@id="stat-overview"]/div[1]/button[1]').click() self.dr.find_element_by_id('begin1').click() self.dr.find_element_by_class_name('laydate-btns-confirm').click() sleep(2) self.dr.find_element_by_xpath('//*[@id="stat-overview"]/div[1]/button[2]').click() self.dr.find_element_by_class_name('layui-layer-btn0').click() sleep(4) self.dr.find_element_by_xpath('//*[@id="pageShow"]/div[2]/div[2]/div').click() sleep(3) self.dr.find_element_by_id('begin2').click() self.dr.find_element_by_id('begin2').send_keys('2020-06-10 00:00:00') self.dr.find_element_by_xpath('//*[@id="stat-detectorview"]/div[1]/button[1]').click() self.dr.find_element_by_id('begin2').click() self.dr.find_element_by_xpath('//*[@id="layui-laydate3"]/div[2]/div/span[3]').click() self.dr.find_element_by_xpath('//*[@id="stat-detectorview"]/div[1]/input[3]').send_keys('MP02MN6191231000032') self.dr.find_element_by_xpath('//*[@id="stat-detectorview"]/div[1]/button[2]').click() self.dr.find_element_by_class_name('layui-layer-btn0').click()
def test_algl(self): deng_lu = Deng_lu(self.dr) deng_lu.denglu() sleep(3) self.dr.find_element_by_xpath( '//*[@id="admin-menus-box"]/div/div[7]/span').click() self.dr.find_element_by_xpath( '//*[@id="admin-menus-box"]/div/div[7]/div/div[4]').click() sleep(3) self.dr.find_element_by_xpath( '//*[@id="pageShow"]/div[1]/div[2]/button').click() sleep(3) self.dr.find_element_by_xpath( '//*[@id="pageShow"]/div/div/div[2]/input').send_keys('自动测试') sleep(3) self.dr.find_element_by_xpath( '//*[@id="pageShow"]/div/div/button[1]').click() sleep(5) self.dr.back() sleep(3) try: self.dr.refresh() # 刷新方法 refresh print('test pass: refresh successful') except Exception as e: print("Exception found", format(e)) sleep(3) self.dr.find_element_by_xpath( '//*[@id="pageShow"]/div[2]/table/tbody/tr[1]/td[2]/button[2]' ).click() self.dr.find_element_by_class_name('layui-layer-btn0').click() sleep(3)
def test_qxgl(self): deng_lu = Deng_lu(self.dr) deng_lu.denglu() sleep(3) self.dr.find_element_by_xpath( '//*[@id="admin-menus-box"]/div/div[4]/span').click() self.dr.find_element_by_xpath( '//*[@id="admin-menus-box"]/div/div[4]/div/div[2]').click() sleep(3) self.dr.find_element_by_class_name('tabs-right').click() sleep(2) self.dr.find_element_by_xpath( '//*[@id="pageShow"]/div[2]/div[1]/div[2]/input').send_keys( '自动测试员') self.dr.find_element_by_xpath('//*[@id="admin.terminal.read"]').click() self.dr.find_element_by_xpath('//*[@id="admin.user.read"]').click() # 设置目标为某个元素,我使用xpath的定位方法 target = self.dr.find_element_by_xpath( '//*[@id="pageShow"]/div[2]/div[3]/button') # 滚动到目标位置 self.dr.execute_script("arguments[0].scrollIntoView();", target) sleep(3) self.dr.find_element_by_xpath( '//*[@id="pageShow"]/div[2]/div[3]/button').click() sleep(3) self.dr.find_element_by_xpath( '//*[@id="pageShow"]/div[2]/table/tbody/tr[7]/td[2]/button[2]' ).click() self.dr.find_element_by_class_name('layui-layer-btn0').click()
def test_sjdc(self): deng_lu = Deng_lu(self.dr) deng_lu.denglu() sleep(3) self.dr.find_element_by_xpath( '//*[@id="admin-menus-box"]/div/div[6]/span').click() self.dr.find_element_by_xpath( '//*[@id="admin-menus-box"]/div/div[6]/div/div[4]').click() sleep(3) a = Select( self.dr.find_element_by_xpath( '//*[@id="equipment"]/div[2]/select[1]')) # 定位下拉框 a.select_by_visible_text("A测试") # 文本定位 b = Select( self.dr.find_element_by_xpath( '//*[@id="equipment"]/div[2]/select[2]')) # 定位下拉框 b.select_by_visible_text("自动测试") # 文本定位 c = Select( self.dr.find_element_by_xpath( '//*[@id="equipment"]/div[2]/select[3]')) # 定位下拉框 c.select_by_visible_text("自动测试") # 文本定位 c = Select( self.dr.find_element_by_xpath( '//*[@id="equipment"]/div[2]/select[4]')) # 定位下拉框 c.select_by_visible_text("请选择设备状态") # 文本定位 self.dr.find_element_by_xpath('//*[@id="stTime"]').click() self.dr.find_element_by_xpath( '//*[@id="layui-laydate1"]/div[1]/div[2]/table/tbody/tr[1]/td[4]' ).click() self.dr.find_element_by_class_name('laydate-btns-confirm').click() sleep(2) self.dr.find_element_by_xpath( '//*[@id="pageShow"]/div[2]/div[2]/table/tbody/tr[2]/td[2]/span[1]/img' ).click() self.dr.find_element_by_xpath( '//*[@id="pageShow"]/div[2]/div[2]/table/tbody/tr[2]/td[2]/span[1]/img' ).click() # 设置目标为某个元素,我使用xpath的定位方法 target = self.dr.find_element_by_xpath( '//*[@id="pageShow"]/div[2]/div[4]/table/tbody/tr[4]/td[2]/span/img' ) # 滚动到目标位置 self.dr.execute_script("arguments[0].scrollIntoView();", target) self.dr.find_element_by_xpath( '//*[@id="pageShow"]/div[2]/div[4]/table/tbody/tr[4]/td[2]/span/img' ).click() self.dr.find_element_by_xpath( '//*[@id="pageShow"]/div[2]/div[4]/table/tbody/tr[4]/td[2]/span/img' ).click() self.dr.find_element_by_xpath( '//*[@id="pageShow"]/div[2]/input').click() self.dr.find_element_by_class_name('layui-layer-btn0').click() # 设置目标为某个元素,我使用xpath的定位方法 target = self.dr.find_element_by_xpath( '//*[@id="equipment"]/div[1]/div[1]/div[2]') # 滚动到目标位置 self.dr.execute_script("arguments[0].scrollIntoView();", target) sleep(5) self.dr.find_element_by_xpath( '//*[@id="equipment"]/div[1]/div[1]/div[2]').click()
def test_bj(self): deng_lu = Deng_lu(self.driver) deng_lu.denglu() sleep(5) self.driver.find_element_by_xpath( '//*[@id="admin-menus-box"]/div/div[1]/span').click() sleep(4) # 点击第二条的复选框 self.driver.find_element_by_xpath( '//*[@id="pageShow"]/div[2]/table/tbody/tr[1]/td[1]').click() # 标记处理第二条报警 #self.driver.find_element_by_xpath('//*[@id="pageShow"]/div[2]/table/tbody/tr[1]/td[9]/button[1]').click() sleep(5) # 点击是 #self.driver.find_element_by_class_name('layui-layer-btn0').click() # 删除第一条报警 #self.driver.find_element_by_xpath('//*[@id="pageShow"]/div[2]/table/tbody/tr[1]/td[9]/button[2]').click() # 点击是 #self.driver.find_element_by_class_name('layui-layer-btn0').click() ''' # 点击第三条的详情 self.driver.find_element_by_xpath('//*[@id="pageShow"]/div[2]/table/tbody/tr[3]/td[9]/button[3]').click() sleep(3) self.driver.find_element_by_xpath('//*[@id="layui-layer100001"]/span[1]/a').click() sleep(3) # 点击第三条的管理 self.driver.find_element_by_xpath('//*[@id="pageShow"]/div[2]/table/tbody/tr[3]/td[9]/button[4]').click() sleep(3) self.driver.find_element_by_xpath('//*[@id="layui-layer100002"]/span[1]/a').click() sleep(3) # 设置目标为某个元素,我使用xpath的定位方法 target = self.driver.find_element_by_xpath('//*[@id="layui-laypage-1"]/span[3]/button') # 滚动到目标位置 self.driver.execute_script("arguments[0].scrollIntoView();", target) self.driver.find_element_by_xpath('//*[@id="layui-laypage-1"]/a[7]').click() sleep(3) target = self.driver.find_element_by_xpath('//*[@id="layui-laypage-1"]/span[3]/button') # 滚动到目标位置 self.driver.execute_script("arguments[0].scrollIntoView();", target) sleep(3) self.driver.find_element_by_xpath('//*[@id="layui-laypage-1"]/a[1]').click() sleep(3) target = self.driver.find_element_by_xpath('//*[@id="layui-laypage-1"]/span[3]/button') # 滚动到目标位置 self.driver.execute_script("arguments[0].scrollIntoView();", target) sleep(3) self.driver.find_element_by_xpath('//*[@id="layui-laypage-1"]/span[3]/input').click() sleep(1) self.driver.find_element_by_xpath('//*[@id="layui-laypage-1"]/span[3]/input').send_keys('3') sleep(1) self.driver.find_element_by_xpath('//*[@id="layui-laypage-1"]/span[3]/button').click() ''' sleep(4)
def test_xtcs(self): deng_lu = Deng_lu(self.dr) deng_lu.denglu() sleep(3) self.dr.find_element_by_xpath( '//*[@id="admin-menus-box"]/div/div[7]/span').click() self.dr.find_element_by_xpath( '//*[@id="admin-menus-box"]/div/div[7]/div/div[1]').click() sleep(3) self.dr.find_element_by_xpath( '//*[@id="pageShow"]/div[2]/table/tbody/tr[1]/td[3]/button').click( ) self.dr.find_element_by_xpath( '//*[@id="pageShow"]/div[4]/div[1]/div/div[2]/input').clear() self.dr.find_element_by_xpath( '//*[@id="pageShow"]/div[4]/div[1]/div/div[2]/input').send_keys( 'FFA500') self.dr.find_element_by_xpath( '//*[@id="pageShow"]/div[4]/div[2]/span[2]').click() sleep(3) self.dr.find_element_by_xpath( '//*[@id="pageShow"]/div[2]/table/tbody/tr[1]/td[3]/button').click( ) self.dr.find_element_by_xpath( '//*[@id="pageShow"]/div[4]/div[1]/div/div[2]/input').clear() self.dr.find_element_by_xpath( '//*[@id="pageShow"]/div[4]/div[1]/div/div[2]/input').send_keys( 'ffffff') self.dr.find_element_by_xpath( '//*[@id="pageShow"]/div[4]/div[2]/span[2]').click() sleep(3) self.dr.find_element_by_xpath( '//*[@id="pageShow"]/div[2]/table/tbody/tr[2]/td[3]/button').click( ) self.dr.find_element_by_xpath( '//*[@id="pageShow"]/div[3]/div[2]/span[2]').click() sleep(3) self.dr.find_element_by_xpath( '//*[@id="pageShow"]/div[2]/table/tbody/tr[3]/td[3]/button').click( ) self.dr.find_element_by_xpath( '//*[@id="pageShow"]/div[4]/div[2]/span[2]').click() sleep(3) self.dr.find_element_by_xpath( '//*[@id="pageShow"]/div[2]/table/tbody/tr[4]/td[3]/button').click( ) self.dr.find_element_by_xpath( '//*[@id="pageShow"]/div[4]/div[2]/span[1]').click() sleep(3)
def test_jdal(self): deng_lu = Deng_lu(self.driver) deng_lu.denglu() sleep(5) self.driver.find_element_by_xpath( '//*[@id="admin-menus-box"]/div/div[2]/span').click() self.driver.find_element_by_xpath( '//*[@id="admin-menus-box"]/div/div[2]/div/div[2]').click() sleep(2) self.driver.find_element_by_xpath( '//*[@id="pageShow"]/div[2]/table/tbody/tr[1]/td[2]/button').click( ) sleep(3) self.driver.back() sleep(3)
def test_xxgl(self): deng_lu = Deng_lu(self.dr) deng_lu.denglu() sleep(3) self.dr.find_element_by_xpath( '//*[@id="admin-menus-box"]/div/div[3]/span').click() #点击电力设备 self.dr.find_element_by_xpath( '//*[@id="admin-menus-box"]/div/div[3]/div/div[2]').click() sleep(3) self.dr.find_element_by_xpath( '//*[@id="pageShow"]/div[1]/div[2]/button').click() self.dr.switch_to.frame('layui-layer-iframe100001') self.dr.find_element_by_xpath( '//*[@id="pageShow"]/div[2]/div[1]/div[2]/input').send_keys('自动测试') self.dr.find_element_by_id('hm').click() js = "$('input[id=hm').removeAttr('readonly')" # 2.jQuery,移除属性 #js = "$('input[id=history_record_time').attr('readonly',false)" # 3.jQuery,设置为false self.dr.execute_script(js) sleep(3) target = self.dr.find_element_by_xpath( '//*[@id="layui-laydate1"]/div[1]/div[2]/ul/li[1]/ol/li[22]') # 滚动到目标位置 self.dr.execute_script("arguments[0].scrollIntoView();", target) sleep(1) self.dr.find_element_by_xpath( '//*[@id="layui-laydate1"]/div[1]/div[2]/ul/li[1]/ol/li[22]' ).click() self.dr.find_element_by_xpath( '//*[@id="layui-laydate1"]/div[1]/div[2]/ul/li[2]/ol/li[1]').click( ) self.dr.find_element_by_xpath( '//*[@id="layui-laydate1"]/div[1]/div[2]/ul/li[3]/ol/li[1]').click( ) sleep(4) #self.dr.find_element_by_id('hm').send_keys('21:00') self.dr.find_element_by_class_name('laydate-btns-confirm').click() sleep(2) self.dr.find_element_by_xpath( '//*[@id="pageShow"]/div[2]/div[5]/div[2]/div[52]/img').click() self.dr.find_element_by_xpath( '//*[@id="pageShow"]/div[2]/div[6]/button').click() sleep(3) self.dr.find_element_by_xpath( '//*[@id="pageShow"]/div[2]/table/tbody/tr[1]/td[5]/button[3]' ).click() sleep(3) self.dr.find_element_by_class_name('tabs-right').click()
def test_yjbg(self): deng_lu = Deng_lu(self.driver) deng_lu.denglu() sleep(5) self.driver.find_element_by_xpath( '//*[@id="admin-menus-box"]/div/div[2]/span').click() self.driver.find_element_by_xpath( '//*[@id="admin-menus-box"]/div/div[2]/div/div[4]').click() sleep(3) #self.driver.find_element_by_xpath('//*[@id="history_record_time"]').click() sleep(6) js = "$('input[id=history_record_time').removeAttr('readonly')" # 2.jQuery,移除属性 #js = "$('input[id=history_record_time').attr('readonly',false)" # 3.jQuery,设置为false self.driver.execute_script(js) sleep(3) self.driver.find_element_by_xpath( '//*[@id="history_record_time"]').clear() sleep(2) self.driver.find_element_by_xpath( '//*[@id="history_record_time"]').send_keys( '2020-06-29 00:00:00 - 2020-06-30 00:00:00') sleep(3) self.driver.find_element_by_xpath( '//*[@id="pageShow"]/div[3]/div/div[5]/div[2]/div/textarea').click( ) sleep(3) self.driver.find_element_by_xpath( '//*[@id="history_record_time"]').click() sleep(2) self.driver.find_element_by_xpath( '//*[@id="layui-laydate1"]/div[3]/div/span').click() a = Select( self.driver.find_element_by_xpath( '//*[@id="pageShow"]/div[2]/div/select')) #定位下拉框 a.select_by_visible_text('T2000跑测') #文本定位 sleep(3) self.driver.find_element_by_xpath( '//*[@id="pageShow"]/div[3]/div/div[2]/table/tbody/tr[2]/td[2]/input' ).send_keys('帝') self.driver.find_element_by_xpath( '//*[@id="pageShow"]/div[3]/div/div[5]/div[2]/div/textarea' ).send_keys('无') sleep(3) self.driver.find_element_by_xpath( '//*[@id="pageShow"]/div[2]/div/button').click()
def test_yhgl(self): deng_lu = Deng_lu(self.dr) deng_lu.denglu() sleep(3) self.dr.find_element_by_xpath( '//*[@id="admin-menus-box"]/div/div[4]/span').click() self.dr.find_element_by_xpath( '//*[@id="admin-menus-box"]/div/div[4]/div/div[1]').click() sleep(3) self.dr.find_element_by_class_name('tabs-right').click() sleep(3) self.dr.find_element_by_xpath( '//*[@id="pageShow"]/div[2]/div[1]/div[2]/input').send_keys( '6666666') self.dr.find_element_by_xpath( '//*[@id="pageShow"]/div[2]/div[2]/div[2]/input').send_keys( '123456') self.dr.find_element_by_xpath( '//*[@id="pageShow"]/div[2]/div[3]/div[2]/input').send_keys('测试') self.dr.find_element_by_xpath( '//*[@id="pageShow"]/div[2]/div[4]/div[2]/input').send_keys( '16666666666') self.dr.find_element_by_xpath( '//*[@id="pageShow"]/div[2]/div[5]/div[2]/input').send_keys( '*****@*****.**') a = Select( self.dr.find_element_by_xpath( '//*[@id="pageShow"]/div[2]/div[6]/div[2]/select')) #定位下拉框 a.select_by_visible_text('专工') #文本定位 b = Select( self.dr.find_element_by_xpath( '//*[@id="pageShow"]/div[2]/div[7]/div[2]/select')) #定位下拉框 b.select_by_visible_text('测试') #文本定位 sleep(2) self.dr.find_element_by_xpath('//*[@id="52"]').click() sleep(2) self.dr.find_element_by_xpath( '//*[@id="pageShow"]/div[2]/div[10]/button').click() sleep(3) self.dr.find_element_by_xpath( '//*[@id="pageShow"]/div[2]/table/tbody/tr[14]/td[6]/button[2]' ).click() self.dr.find_element_by_class_name('layui-layer-btn0').click()
def test_xxts(self): deng_lu = Deng_lu(self.dr) deng_lu.denglu() sleep(3) self.dr.find_element_by_xpath( '//*[@id="admin-menus-box"]/div/div[7]/span').click() self.dr.find_element_by_xpath( '//*[@id="admin-menus-box"]/div/div[7]/div/div[2]').click() sleep(3) self.dr.find_element_by_xpath( '//*[@id="pageShow"]/div[2]/table/tbody/tr[1]/td/span[2]/input' ).send_keys('smtp.mxhichina.com') self.dr.find_element_by_xpath( '//*[@id="pageShow"]/div[2]/table/tbody/tr[2]/td/span[2]/input' ).send_keys('*****@*****.**') self.dr.find_element_by_xpath( '//*[@id="pageShow"]/div[2]/table/tbody/tr[3]/td/span[2]/input' ).send_keys('迈内能源') self.dr.find_element_by_xpath( '//*[@id="pageShow"]/div[2]/table/tbody/tr[4]/td/span[2]/input' ).send_keys('*****@*****.**') self.dr.find_element_by_xpath( '//*[@id="pageShow"]/div[2]/table/tbody/tr[5]/td/span[2]/input' ).send_keys('*****@*****.**') self.dr.find_element_by_xpath( '//*[@id="pageShow"]/div[2]/table/tbody/tr[6]/td/span[2]/input' ).send_keys('465') self.dr.find_element_by_xpath( '//*[@id="pageShow"]/div[2]/table/tbody/tr[7]/td/span[2]/input' ).send_keys('tls') a = Select( self.dr.find_element_by_xpath( '//*[@id="pageShow"]/div[2]/table/tbody/tr[8]/td/span[2]/select' )) # 定位下拉框 a.select_by_visible_text("发送") # 文本定位 sleep(3) self.dr.find_element_by_xpath( '//*[@id="pageShow"]/div[2]/table/tbody/tr[9]/td/button').click()
def test_sjfx(self): deng_lu = Deng_lu(self.driver) deng_lu.denglu() sleep(5) # 点击大数据 self.driver.find_element_by_xpath( '//*[@id="admin-menus-box"]/div/div[2]').click() sleep(2) # 点击数据分析 self.driver.find_element_by_xpath( '//*[@id="admin-menus-box"]/div/div[2]/div/div[1]').click() sleep(3) self.driver.find_element_by_xpath( '//*[@id="pageShow"]/div[3]/table/tbody/tr[3]/td[2]/button').click( ) sleep(3) self.driver.find_element_by_xpath( '//*[@id="pageShow"]/div[2]/div[2]/div[2]/div[4]/span').click() sleep(1) self.driver.find_element_by_xpath( '//*[@id="pageShow"]/div[2]/div[2]/div[3]/div[1]/div[2]/span' ).click() sleep(3) self.driver.find_element_by_id('history_record_time').send_keys( '2020-06-18 16:36:47 - 2020-06-23 16:36:47') sleep(1) self.driver.find_element_by_xpath( '//*[@id="layui-laydate1"]/div[3]/div/span').click() sleep(2) self.driver.find_element_by_xpath( '//*[@id="pageShow"]/div[2]/div[2]/div[4]/div/select') #定位下拉框 sleep(1) self.driver.find_elements_by_tag_name('option')[1].click() #获取下拉框第二个选项 self.driver.find_element_by_xpath( '//*[@id="pageShow"]/div[2]/div[3]/div[1]/div[2]').click() sleep(4)
def test_zdlb(self): deng_lu = Deng_lu(self.dr) deng_lu.denglu() sleep(3) self.dr.find_element_by_xpath('//*[@id="admin-menus-box"]/div/div[6]/span').click() self.dr.find_element_by_xpath('//*[@id="admin-menus-box"]/div/div[6]/div/div[3]').click() sleep(3) self.dr.find_element_by_xpath('//*[@id="pageShow"]/div[2]/select[1]').click() self.dr.find_element_by_xpath('//*[@id="pageShow"]/div[2]/select[2]').click() self.dr.find_element_by_xpath('//*[@id="pageShow"]/div[2]/select[3]').click() self.dr.find_element_by_xpath('//*[@id="pageShow"]/div[2]/select[4]').click() self.dr.find_element_by_xpath('//*[@id="pageShow"]/div[2]/select[5]').click() self.dr.find_element_by_xpath('//*[@id="pageShow"]/div[2]/select[6]').click() self.dr.find_element_by_xpath('//*[@id="pageShow"]/div[2]/select[7]').click() self.dr.find_element_by_xpath('//*[@id="pageShow"]/div[2]/button[1]').click() self.dr.find_element_by_xpath('//*[@id="pageShow"]/div[2]/button[2]').click() self.dr.find_element_by_xpath('//*[@id="pageShow"]/div[2]/button[3]').click() sleep(3) self.dr.find_element_by_xpath('//*[@id="pageShow"]/div[2]/input[1]').send_keys('000032') sleep(2) self.dr.find_element_by_xpath('//*[@id="pageShow"]/div[3]/table/tbody/tr[1]/td/div/div[1]').click() sleep(3) self.dr.find_element_by_xpath('//*[@id="pageShow"]/div[3]/table/tbody/tr[2]/td[8]/table/tbody/tr[1]/td[1]/span/span').click() sleep(3) self.dr.find_element_by_xpath('//*[@id="pageShow"]/div[2]/div[1]/div[2]/div[2]/span').click() sleep(1) self.dr.find_element_by_xpath('//*[@id="pageShow"]/div[2]/div[1]/div[2]/div[3]/span').click() self.dr.find_element_by_id('history_record_time').click() sleep(2) self.dr.find_element_by_xpath('//*[@id="layui-laydate1"]/div[1]/div[2]/table/tbody/tr[1]/td[4]').click() self.dr.find_element_by_class_name('laydate-btns-confirm').click() sleep(3) # 设置目标为某个元素,我使用xpath的定位方法 target = self.dr.find_element_by_xpath('//*[@id="pageShow"]/div[3]/div[2]/div[1]/div[2]/div[2]/div/div[7]/div/button') # 滚动到目标位置 self.dr.execute_script("arguments[0].scrollIntoView();", target) sleep(3) self.dr.find_element_by_xpath('//*[@id="pageShow"]/div[3]/div[2]/div[1]/div[2]/div[2]/div/div[7]/div/button').click() sleep(2) self.dr.find_element_by_xpath('//*[@id="layui-layer100001"]/span[1]/a').click() sleep(3) self.dr.back() sleep(4) self.dr.find_element_by_xpath('//*[@id="pageShow"]/div[2]/input[1]').clear() self.dr.find_element_by_xpath('//*[@id="pageShow"]/div[2]/input[1]').send_keys('000032') sleep(2) self.dr.find_element_by_xpath('//*[@id="pageShow"]/div[3]/table/tbody/tr[1]/td/div/div[1]').click() sleep(2) self.dr.find_element_by_xpath('//*[@id="pageShow"]/div[3]/table/tbody/tr[2]/td[8]/table/tbody/tr[1]/td[2]/span').click() self.dr.find_element_by_class_name('layui-layer-btn1').click() self.dr.find_element_by_xpath('//*[@id="pageShow"]/div[3]/table/tbody/tr[2]/td[8]/table/tbody/tr[1]/td[3]/span/span').click() sleep(1) self.dr.find_element_by_xpath('//*[@id="layui-layer100002"]/span[1]/a').click() sleep(3) self.dr.find_element_by_xpath('//*[@id="pageShow"]/div[3]/table/tbody/tr[2]/td[8]/table/tbody/tr[1]/td[4]/span/span').click() self.dr.find_element_by_class_name('layui-layer-btn1').click() self.dr.find_element_by_xpath('//*[@id="pageShow"]/div[3]/table/tbody/tr[2]/td[8]/table/tbody/tr[1]/td[4]/span/span').click() sleep(2) self.dr.find_element_by_class_name('layui-layer-btn1').click() self.dr.find_element_by_xpath('//*[@id="pageShow"]/div[3]/table/tbody/tr[2]/td[8]/table/tbody/tr[2]/td[1]/span/span').click() sleep(2) self.dr.find_element_by_class_name('layui-layer-btn1').click() self.dr.find_element_by_xpath('//*[@id="pageShow"]/div[3]/table/tbody/tr[2]/td[8]/table/tbody/tr[2]/td[2]/span/span').click() sleep(3) self.dr.find_element_by_xpath('//*[@id="pageShow"]/div[3]/table/tbody/tr[1]/td[1]/div/span').click() self.dr.back() sleep(3) self.dr.find_element_by_xpath('//*[@id="pageShow"]/div[3]/table/tbody/tr[1]/td/div/div[1]').click() self.dr.find_element_by_xpath('//*[@id="pageShow"]/div[3]/table/tbody/tr[2]/td[8]/table/tbody/tr[2]/td[3]/span/span').click() sleep(2) self.dr.find_element_by_xpath('//*[@id="layui-layer100001"]/span[1]/a').click() self.dr.find_element_by_xpath('//*[@id="pageShow"]/div[3]/table/tbody/tr[2]/td[8]/table/tbody/tr[2]/td[4]/span/span').click() sleep(3) self.dr.find_element_by_xpath('//*[@id="pageShow"]/div[3]/table/tbody/tr[1]/td[1]/div/span').click() self.dr.back() sleep(3) self.dr.find_element_by_xpath('//*[@id="pageShow"]/div[3]/table/tbody/tr[1]/td/div/div[1]').click() self.dr.find_element_by_xpath('//*[@id="pageShow"]/div[3]/table/tbody/tr[2]/td[8]/table/tbody/tr[3]/td[1]/span/span').click() sleep(3) self.dr.find_element_by_xpath('//*[@id="layui-layer100001"]/span[1]/a').click() self.dr.find_element_by_xpath('//*[@id="pageShow"]/div[3]/table/tbody/tr[2]/td[8]/table/tbody/tr[3]/td[2]/span/span').click() self.dr.find_element_by_class_name('layui-layer-btn1').click() self.dr.find_element_by_xpath('//*[@id="pageShow"]/div[3]/table/tbody/tr[2]/td[8]/table/tbody/tr[3]/td[3]/span/span').click() sleep(2) self.dr.find_element_by_class_name('layui-layer-btn1').click() self.dr.find_element_by_xpath('//*[@id="pageShow"]/div[3]/table/tbody/tr[2]/td[8]/table/tbody/tr[4]/td/span/span').click() sleep(3) self.dr.find_element_by_xpath('//*[@id="pageShow"]/div[3]/table/tbody/tr[1]/td[1]/div[1]/span').click() sleep(5) self.dr.back() sleep(5)
def test_tzgl(self): deng_lu = Deng_lu(self.dr) deng_lu.denglu() sleep(3) self.dr.find_element_by_xpath( '//*[@id="admin-menus-box"]/div/div[3]/span').click() self.dr.find_element_by_xpath( '//*[@id="admin-menus-box"]/div/div[3]/div/div[1]').click() sleep(3) self.dr.find_element_by_xpath( '//*[@id="pageShow"]/div[1]/div[2]/button').click() sleep(3) self.dr.switch_to.frame('layui-layer-iframe100001') self.dr.find_element_by_xpath( '//*[@id="pageShow"]/div/div[2]/div[2]/input').click() self.dr.find_element_by_xpath( '//*[@id="pageShow"]/div/div[2]/div[2]/input').send_keys('A测试') self.dr.find_element_by_xpath( '//*[@id="pageShow"]/div/div[3]/button').click() sleep(3) #self.dr.find_element_by_xpath('//*[@id="pageShow"]/div[1]/div[2]/button').click() #self.dr.switch_to.default_content() #self.dr.find_element_by_xpath('//*[@id="layui-layer100002"]/span[1]/a').click() sleep(3) # 设置目标为某个元素,我使用xpath的定位方法 target = self.dr.find_element_by_xpath( '//*[@id="pageShow"]/div[2]/table/tbody/tr[357]/td[1]/span') # 滚动到目标位置 self.dr.execute_script("arguments[0].scrollIntoView();", target) sleep(2) self.dr.find_element_by_xpath( '//*[@id="pageShow"]/div[2]/table/tbody/tr[357]/td[2]/button[5]' ).click() self.dr.switch_to.frame('layui-layer-iframe100002') sleep(2) #a=Select(self.dr.find_element_by_xpath('//*[@id="pageShow"]/div/div[2]/div[2]/select'))#定位下拉框 #a.select_by_visible_text('GIS设备')#文本定位 #sleep(3) self.dr.find_element_by_xpath( '//*[@id="pageShow"]/div/div[3]/div[2]/input').click() self.dr.find_element_by_xpath( '//*[@id="pageShow"]/div/div[3]/div[2]/input').send_keys('自动测试') self.dr.find_element_by_xpath( '//*[@id="pageShow"]/div/div[5]/button').click() sleep(3) self.dr.find_element_by_xpath( '//*[@id="pageShow"]/div[2]/table/tbody/tr[357]/td[1]').click() sleep(2) self.dr.find_element_by_xpath( '//*[@id="pageShow"]/div[2]/table/tbody/tr[358]/td[2]/button[3]' ).click() self.dr.switch_to.frame('layui-layer-iframe100003') self.dr.find_element_by_xpath( '//*[@id="pageShow"]/div/div[2]/div[2]/input').send_keys('自动测试') self.dr.find_element_by_xpath( '//*[@id="pageShow"]/div/div[3]/div[2]/input').send_keys( '123456789') #self.dr.find_element_by_xpath('//*[@id="pageShow"]/div/div[4]/div[2]/input').send_keys('01') #self.dr.find_element_by_xpath('//*[@id="pageShow"]/div/div[5]/div[2]/input').send_keys('00000') self.dr.find_element_by_xpath( '//*[@id="pageShow"]/div/div[11]/button').click()
def test_qlkj(self): deng_lu = Deng_lu(self.dr) deng_lu.denglu() sleep(3) self.dr.find_element_by_xpath( '//*[@id="admin-menus-box"]/div/div[7]/span').click() self.dr.find_element_by_xpath( '//*[@id="admin-menus-box"]/div/div[7]/div/div[3]').click() sleep(3) self.dr.find_element_by_xpath( '//*[@id="pageShow"]/div[2]/table/tbody/tr[2]/td/form/span[2]/input[1]' ).clear() self.dr.find_element_by_xpath( '//*[@id="pageShow"]/div[2]/table/tbody/tr[2]/td/form/span[2]/input[1]' ).send_keys('180') self.dr.find_element_by_id('startTime').click() #self.dr.find_element_by_id('startTime').send_keys('2020-01-01') self.dr.find_element_by_xpath( '//*[@id="layui-laydate1"]/div[1]/div[1]/i[2]').click() self.dr.find_element_by_xpath( '//*[@id="layui-laydate1"]/div[1]/div[1]/i[2]').click() self.dr.find_element_by_xpath( '//*[@id="layui-laydate1"]/div[1]/div[1]/i[2]').click() self.dr.find_element_by_xpath( '//*[@id="layui-laydate1"]/div[1]/div[1]/i[2]').click() self.dr.find_element_by_xpath( '//*[@id="layui-laydate1"]/div[1]/div[1]/i[2]').click() self.dr.find_element_by_xpath( '//*[@id="layui-laydate1"]/div[1]/div[1]/i[2]').click() self.dr.find_element_by_xpath( '//*[@id="layui-laydate1"]/div[1]/div[1]/i[2]').click() self.dr.find_element_by_xpath( '//*[@id="layui-laydate1"]/div[1]/div[2]/table/tbody/tr[3]/td[4]' ).click() sleep(5) self.dr.find_element_by_id('endTime').click() self.dr.find_element_by_xpath( '//*[@id="layui-laydate2"]/div[1]/div[1]/i[2]').click() self.dr.find_element_by_xpath( '//*[@id="layui-laydate2"]/div[1]/div[1]/i[2]').click() self.dr.find_element_by_xpath( '//*[@id="layui-laydate2"]/div[1]/div[1]/i[2]').click() self.dr.find_element_by_xpath( '//*[@id="layui-laydate2"]/div[1]/div[1]/i[2]').click() self.dr.find_element_by_xpath( '//*[@id="layui-laydate2"]/div[1]/div[1]/i[2]').click() self.dr.find_element_by_xpath( '//*[@id="layui-laydate2"]/div[1]/div[1]/i[2]').click() self.dr.find_element_by_xpath( '//*[@id="layui-laydate2"]/div[1]/div[2]/table/tbody/tr[2]/td[3]' ).click() self.dr.find_element_by_xpath( '//*[@id="pageShow"]/div[2]/table/tbody/tr[3]/td/button').click() self.dr.find_element_by_class_name('layui-layer-btn1').click() sleep(3) self.dr.find_element_by_xpath( '//*[@id="pageShow"]/div[2]/table/tbody/tr[4]/td/form/span[2]/div/em' ).click() self.dr.find_element_by_xpath( '//*[@id="pageShow"]/div[2]/table/tbody/tr[4]/td/form/span[2]/div/em' ).click() sleep(4)
def test_fzgl(self): deng_lu = Deng_lu(self.driver) deng_lu.denglu() sleep(5) self.driver.find_element_by_xpath( '//*[@id="admin-menus-box"]/div/div[2]').click() sleep(1) self.driver.find_element_by_xpath( '//*[@id="admin-menus-box"]/div/div[2]/div/div[3]').click() sleep(2) #添加分组- self.driver.find_element_by_xpath( '//*[@id="pageShow"]/div[1]/div[2]/button').click() self.driver.find_element_by_xpath( '//*[@id="pageShow"]/div[2]/div/div[1]/div[2]/input').click() sleep(1) self.driver.find_element_by_xpath( '//*[@id="pageShow"]/div[2]/div/div[1]/div[2]/input').send_keys( '测试分组1') a = Select( self.driver.find_element_by_xpath( '//*[@id="pageShow"]/div[2]/div/div[2]/div[2]/select')) #定位下拉框 a.select_by_visible_text('T2000跑测') #文本定位 sleep(3) self.driver.find_element_by_xpath( '//*[@id="pageShow"]/div[2]/div/div[3]/div[1]/label').click() self.driver.find_element_by_xpath('//*[@id="29"]').click() # 使用保存的元素 target = self.driver.find_element_by_xpath( '//*[@id="pageShow"]/div[2]/div/div[5]/button') # 滚动到保存位置 self.driver.execute_script("arguments[0].scrollIntoView();", target) sleep(3) self.driver.find_element_by_xpath( '//*[@id="pageShow"]/div[2]/div/div[5]/button').click() #添加分组--- sleep(4) self.driver.find_element_by_xpath( '//*[@id="pageShow"]/div[3]/table/tbody/tr[1]/td[3]/button[1]' ).click() self.driver.find_element_by_xpath( '//*[@id="pageShow"]/div[2]/div/div[1]/div[2]/input').click() self.driver.find_element_by_xpath( '//*[@id="pageShow"]/div[2]/div/div[1]/div[2]/input').clear( ) # 清空文本框内容 sleep(3) self.driver.find_element_by_xpath( '//*[@id="pageShow"]/div[2]/div/div[1]/div[2]/input').send_keys( '自动测试') self.driver.find_element_by_xpath( '//*[@id="pageShow"]/div[2]/div/div[4]/div[2]/div[1]/span[2]' ).click() sleep(1) self.driver.find_element_by_class_name('layui-btn').click() sleep(5) self.driver.find_element_by_xpath( '//*[@id="pageShow"]/div[3]/table/tbody/tr[1]/td[3]/button[3]' ).click() self.driver.back() sleep(2) self.driver.find_element_by_xpath( '//*[@id="pageShow"]/div[3]/table/tbody/tr[1]/td[3]/button[2]' ).click() sleep(2) self.driver.find_element_by_class_name('layui-layer-btn0').click() sleep(2) self.driver.find_element_by_xpath( '//*[@id="pageShow"]/div[2]/input').click() self.driver.find_element_by_xpath( '//*[@id="pageShow"]/div[2]/input').send_keys('gis1') sleep(4)