from 预定系统.Base.app_base import * import logging from time import sleep # 配置日志记录 logging.basicConfig(level=logging.DEBUG, format='%(asctime)s - %(levelname)s - %(message)s') class Exhibition_Meeting_Control_0001: """ 执行指令: 1.cd 预定系统 2.hytest --report_title 会议预约测试报告 --report_url_prefix http://192.168.1.225 --tag 展厅会议室中控屏 """ tags = ['展厅会议室中控屏','展厅巡检'] def teststeps(self): """ 执行测试步骤以自动化测试腾讯会议应用的登录和会议加入流程。 该方法初始化应用驱动,等待应用加载,定位并点击会议按钮,加入会议,并截取会议画面。 """ app_drive = None try: # 初始化应用驱动,连接到指定的设备和应用 app_drive = app_setup_driver("Android", "5.1.1", "UT-12", "com.ubains.gviewer.develop", "com.ubains.gviewer.activity.SplashActivity", "192.168.5.142:5555") app_drive.implicitly_wait(60) # 设置缺省等待时间 logging.info("等待登录页加载...") sleep(20) # 点击【进入系统】按钮 enter_system_button = app_drive.find_element(AppiumBy.XPATH, "/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.widget.Button[9]") enter_system_button.click() sleep(20) logging.info("进入系统") # 点击【确认】按钮 logging.info("点击【确认】按钮") confirm_button = app_drive.find_element(AppiumBy.XPATH, "/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.widget.FrameLayout/android.widget.RelativeLayout[2]/android.widget.Button[1]") confirm_button.click() sleep(10) # 进入视频会议模式,使用摄像头跟踪功能 logging.info("进入视频会议模式") video_meeting_button = app_drive.find_element(AppiumBy.XPATH, "/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.widget.FrameLayout/android.widget.RelativeLayout[4]/android.widget.Button[14]") video_meeting_button.click() sleep(20) # 点击【入住式会议】按钮 logging.info("点击【入住式会议】按钮") enter_meeting_button = app_drive.find_element(AppiumBy.XPATH, "/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.widget.FrameLayout/android.widget.RelativeLayout[5]/android.widget.Button[2]") enter_meeting_button.click() sleep(20) # 点击【摄像头跟踪】按钮 logging.info("点击【摄像头跟踪】按钮") camera_tracking_button = app_drive.find_element(AppiumBy.XPATH, "/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.widget.FrameLayout/android.widget.RelativeLayout[5]/android.widget.Button[30]") camera_tracking_button.click() sleep(10) #选择左屏进行摄像头跟踪 logging.info("选择左屏进行摄像头跟踪") left_screen_button = app_drive.find_element(AppiumBy.XPATH, "/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.widget.FrameLayout/android.widget.RelativeLayout[6]/android.widget.Button[3]") left_screen_button.click() sleep(20) # 返回上一级界面 logging.info("返回上一级界面") back_button = app_drive.find_element(AppiumBy.XPATH, "/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.widget.FrameLayout/android.widget.RelativeLayout[6]/android.widget.Button[1]") back_button.click() sleep(10) # 点击无纸化 logging.info("点击无纸化") no_paper_button = app_drive.find_element(AppiumBy.XPATH, "/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.widget.FrameLayout/android.widget.RelativeLayout[5]/android.widget.Button[10]") no_paper_button.click() sleep(30) # 点击【全部上升】按钮 logging.info("点击【全部上升】按钮") all_up_button = app_drive.find_element(AppiumBy.XPATH, "/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.widget.FrameLayout/android.widget.RelativeLayout[6]/android.widget.Button[1]") all_up_button.click() sleep(30) except Exception as e: # 捕获并记录任何发生的错误 logging.error(f"发生错误: {e}", exc_info=True) finally: # 确保驱动程序在测试结束后正确关闭 if app_drive: app_drive.quit() logging.info("驱动程序已退出。")