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

调试appium移动端脚本,控制手机进入腾讯会议。调试定位失败问题。更换定位工具以及定位方法调用。

上级 6ad6a72d
......@@ -91,3 +91,5 @@
- 调整browser_init函数改为传参方式传入登录页面URL,调整相关脚本的函数调用。
- 根据展厅预定系统的巡检流程输出脚本程序。进一步调试会控界面部分元素定位失败的问题以及议题文件上传失败的问题。
- 调试appium移动端脚本,控制手机进入腾讯会议查看会控界面是否正常。补充appium运行日志,调试定位失败问题。
27. 2024-12-11
- 调试appium移动端脚本,控制手机进入腾讯会议。调试定位失败问题。更换定位工具以及定位方法调用。
\ No newline at end of file
from appium.webdriver.common.appiumby import AppiumBy
from 预定系统.Base.app_base import *
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from time import sleep
import logging
# 配置日志记录
......@@ -11,49 +11,20 @@ logging.basicConfig(level=logging.DEBUG, format='%(asctime)s - %(levelname)s - %
def app_txcent_test():
app_drive = None
try:
# 腾讯:"com.tencent.wemeet.app" ".StartupActivity"
app_drive = app_setup_driver("Android", "12", "RedmiK30Pro", "com.tencent.wemeet.app", ".StartupActivity")
app_drive.implicitly_wait(20) # 设置缺省等待时间
# 使用显式等待来等待元素出现
logging.info("等待登录页加载...")
element = WebDriverWait(app_drive, 60).until(
EC.element_to_be_clickable((By.ID, "f7"))
)
if element.is_displayed() and element.is_enabled():
element.click()
logging.info("点击 f7 成功")
else:
logging.warning("元素 f7 未显示或不可点击")
sleep(2)
element = WebDriverWait(app_drive, 60).until(
EC.element_to_be_clickable((By.ID, "kr"))
)
if element.is_displayed() and element.is_enabled():
element.click()
logging.info("点击 kr 成功")
else:
logging.warning("元素 kr 未显示或不可点击")
sleep(2)
element = WebDriverWait(app_drive, 60).until(
EC.element_to_be_clickable((By.ID, "kr"))
)
if element.is_displayed() and element.is_enabled():
element.send_keys("562483854")
logging.info("输入 562483854 成功")
else:
logging.warning("元素 kr 未显示或不可点击")
sleep(5)
element = WebDriverWait(app_drive, 60).until(
EC.element_to_be_clickable((By.ID, "y0"))
)
if element.is_displayed() and element.is_enabled():
element.click()
logging.info("点击 y0 成功")
else:
logging.warning("元素 y0 未显示或不可点击")
# 定位【加入会议】按钮元素,并点击按钮
logging.info("尝试定位【加入会议】按钮元素,并点击按钮")
join_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.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/androidx.viewpager.widget.ViewPager/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup[2]/android.widget.LinearLayout[1]/android.widget.ImageView")
logging.info("定位【加入会议】按钮成功")
# 点击【加入会议】按钮
join_meeting_button.click()
logging.info("点击【加入会议】按钮成功")
except Exception as e:
logging.error(f"发生错误: {e}", exc_info=True)
......@@ -66,3 +37,4 @@ def app_txcent_test():
if __name__ == '__main__':
app_txcent_test()
# match()
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论