提交 e7e447e2 authored 作者: 陈泽健's avatar 陈泽健

增加麦克风与摄像头控制按钮控制,以及云喇叭调用播放音频流程.

上级 cd49e800
from appium.webdriver.common.appiumby import AppiumBy
from time import sleep
from appium.options.android import UiAutomator2Options
from selenium import webdriver
import time
from hytest import *
from selenium import webdriver
from selenium.common import TimeoutException, NoSuchElementException, ElementNotInteractableException
from selenium.webdriver.common.keys import Keys
from urllib.parse import urlencode
from datetime import datetime
def app_setup_driver(platformName, platformVersion, deviceName, appPackage, appActivity, udid):
......
......@@ -185,4 +185,6 @@
- 根据测试报告打印的异常信息,调整会议主流程相关代码的定位方式。
45. 2025-01-22
- 根据测试报告处理统一平台没有截图的问题。调整议题上传函数等待时间。
- 封装云喇叭的注册与播放接口调用,后续对接至展厅巡检流程中。
\ No newline at end of file
- 封装云喇叭的注册与播放接口调用,后续对接至展厅巡检流程中。
46. 2025-01-23
- 增加麦克风与摄像头控制按钮控制,以及云喇叭调用播放音频流程.
\ No newline at end of file
from 预定系统.Base.app_base import *
from 预定系统.Base.base import *
import logging
from time import sleep
......@@ -26,6 +27,37 @@ class Exhibition_Meeting_Control_0001:
app_drive.implicitly_wait(60) # 设置缺省等待时间
logging.info("等待登录页加载...")
sleep(20)
# 点击左上角logo进入后台
# 等待元素可见,并在可见后执行长按操作。
enter_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/android.widget.Button[1]")
logging.info("点击左上角logo进入后台")
enter_back_button.click()
sleep(10)
logging.info("尝试定位麦克风按钮")
mic_on_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[2]")
logging.info("开启麦克风")
mic_on_button.click()
sleep(10)
app_id = os.getenv("APP_ID", "a98a124c6c3252f6612fc544a0d0fa79")
app_secret = os.getenv("APP_SECRET", "88bc1ec4eba624f47b2200a4ce8c3852")
device_sn = os.getenv("DEVICE_SN", "W703BB44444")
play_cloud_voice(app_id, app_secret, device_sn)
sleep(10)
mic_off_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[3]")
mic_off_button.click()
sleep(10)
# 关闭左摄像头
left_camera_off_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[5]")
logging.info("关闭左摄像头")
left_camera_off_button.click()
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]")
......@@ -88,6 +120,7 @@ class Exhibition_Meeting_Control_0001:
all_up_button.click()
sleep(30)
except Exception as e:
# 捕获并记录任何发生的错误
logging.error(f"发生错误: {e}", exc_info=True)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论