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

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

上级 87c5fcb2
......@@ -217,7 +217,8 @@ def issue_send_and_upload(wd , issue_num, issue_name, issue_file_name):
sleep(2)
INFO("点击【选择文件】按钮")
upload_button = WebDriverWait(wd, 60).until(
EC.element_to_be_clickable((By.XPATH, "//label[@id='global-uploader-btn']")))
EC.visibility_of_element_located((By.XPATH, '//*[@id="global-uploader-btn"]/input')))
INFO(f"元素定位:{upload_button}")
INFO("选择议题文件上传")
upload_button.send_keys(file_path)
sleep(1)
......@@ -653,28 +654,36 @@ def get_reportfile_send_dingding(report_title, report_url_prefix):
# if __name__ == '__main__':
# get_reportfile_send_dingding("测试","http://192.168.1.166")
def double_click_and_drag(source_element_locator, target_element_locator, wd):
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.common.exceptions import TimeoutException, NoSuchElementException
import logging
def single_click_and_drag(source_element_locator, target_element_locator, wd):
"""
实现元素从source_element击后拖拽到target_element的功能
实现元素从source_element击后拖拽到target_element的功能
:param wd: WebDriver实例
:param source_element_locator: 拖拽起始元素的定位器
:param target_element_locator: 拖拽目标元素的定位器
"""
try:
# 等待页面完全加载
sleep(3)
# 找到源元素和目标元素
source_element = WebDriverWait(wd, 60).until(EC.visibility_of_element_located(source_element_locator))
target_element = WebDriverWait(wd, 60).until(EC.visibility_of_element_located(target_element_locator))
source_element = WebDriverWait(wd, 120).until(EC.element_to_be_clickable(source_element_locator))
target_element = WebDriverWait(wd, 120).until(EC.element_to_be_clickable(target_element_locator))
# 使用ActionChains执行双击操作
# 使用ActionChains执行单击并拖拽操作
actions = ActionChains(wd)
actions.double_click(source_element).perform()
# 等待双击操作生效
WebDriverWait(wd, 10).until(EC.staleness_of(source_element))
actions.click_and_hold(source_element) # 单击并按住源元素
actions.move_to_element(target_element) # 移动到目标元素
actions.release() # 释放鼠标
actions.perform()
# 使用ActionChains执行拖拽操作
actions.drag_and_drop(source_element, target_element).perform()
logging.info("单击并拖拽操作成功")
except TimeoutException as e:
logging.error(f"元素查找超时: {e}")
except NoSuchElementException as e:
......
......@@ -92,4 +92,5 @@
- 根据展厅预定系统的巡检流程输出脚本程序。进一步调试会控界面部分元素定位失败的问题以及议题文件上传失败的问题。
- 调试appium移动端脚本,控制手机进入腾讯会议查看会控界面是否正常。补充appium运行日志,调试定位失败问题。
27. 2024-12-11
- 调试appium移动端脚本,控制手机进入腾讯会议。调试定位失败问题。更换定位工具以及定位方法调用。
\ No newline at end of file
- 调试appium移动端脚本,控制手机进入腾讯会议。调试定位失败问题。更换定位工具以及定位方法调用。
- 调试排查测试报告网址打不开问题,处理会控界面会场拖拽问题。
\ No newline at end of file
......@@ -41,7 +41,7 @@ class Conference_Query_000x:
"""
执行指令:
1.cd 预定系统
2.hytest --report_title 会议室查询测试报告 --test 会议室查询_0**
2.hytest --report_title 会议室查询测试报告 --report_url_prefix http://192.168.1.225 --test 会议室查询_0**
"""
ddt_cases = read_csv_data(csv_file_path)
......
......@@ -22,7 +22,7 @@ class Exhibition_hall_inspection_000x:
"""
执行指令:
1.cd 预定系统
2.hytest --report_title 会议预约测试报告 --report_url_prefix http://nat.ubainsyun.com:31133 --test 展厅巡检_0**
2.hytest --report_title 会议预约测试报告 --report_url_prefix http://192.168.1.225 --test 展厅巡检_0**
"""
ddt_cases = read_csv_data(csv_file_path)
......@@ -99,7 +99,7 @@ class Exhibition_hall_inspection_000x:
# 调用函数添加议题
INFO("添加议题文件")
# issue_send_and_upload(wd, 2, issue_name, "议题图片.png")
issue_send_and_upload(wd, 2, issue_name, r"D:\GithubData\自动化测试\ubains-module-test\预定系统\cases\展厅巡检\img.png")
# 将字符串转换为时间对象
start_time = datetime.strptime(book_start_time, time_format)
......@@ -284,8 +284,9 @@ class Exhibition_hall_inspection_000x:
# 将左侧会场拖拽到右侧画面进行播放
INFO("将左侧会场拖拽到右侧画面进行播放")
double_click_and_drag((By.XPATH,"//div[contains(@class,'cell')]//span[contains(text(),'展厅指挥中心')]"), (By.XPATH,"//div[@id='screens4']//div[1]//p[1]//span[1]") , wd)
sleep(1)
double_click_and_drag((By.XPATH,"//div[@class='cell']//span[contains(text(),'391558766')]"), (By.XPATH,"//div[@id='screens4']//div[1]//p[1]//span[1]") , wd)
single_click_and_drag((By.XPATH,"//span[contains(text(),'展厅会议室')]"), (By.XPATH,"(//div)[118]") , wd)
wd.refresh()
sleep(2)
single_click_and_drag((By.XPATH,"//span[contains(text(),'展厅指挥中心')]"), (By.XPATH,"(//div)[119]") , wd)
sleep(4)
SELENIUM_LOG_SCREEN(wd, "50%", "Exhibit_Inspect", "MeetingControl", "会场控制")
\ No newline at end of file
from time import sleep
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
import logging
# 配置日志记录
......@@ -18,11 +16,19 @@ def app_txcent_test():
# 使用显式等待来等待元素出现
logging.info("等待登录页加载...")
# 定位【加入会议】按钮元素,并点击按钮
# 定位第一场会议按钮元素,并点击按钮
logging.info("尝试定位【会议名称】按钮元素,并点击按钮")
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.widget.LinearLayout[1]/android.view.ViewGroup/android.widget.RelativeLayout/androidx.recyclerview.widget.RecyclerView/android.view.ViewGroup/android.view.ViewGroup/androidx.appcompat.widget.LinearLayoutCompat/android.view.ViewGroup/android.widget.TextView")
logging.info("定位会议成功")
# 点击【加入会议】按钮
meeting_button.click()
logging.info("点击【会议】按钮成功")
sleep(2)
# 点击【加入会议】按钮
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")
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.view.ViewGroup/androidx.appcompat.widget.LinearLayoutCompat/androidx.appcompat.widget.LinearLayoutCompat/android.widget.TextView")
logging.info("定位【加入会议】按钮成功")
# 点击【加入会议】按钮
join_meeting_button.click()
logging.info("点击【加入会议】按钮成功")
......@@ -37,4 +43,3 @@ def app_txcent_test():
if __name__ == '__main__':
app_txcent_test()
# match()
......@@ -29,7 +29,7 @@ class Login_00x:
"""
执行指令是:
1.cd 预定系统
2.hytest --report_title 账号密码登录测试报告 --report_url_prefix http://192.168.1.166 --test 登录_0**
2.hytest --report_title 账号密码登录测试报告 --report_url_prefix http://192.168.1.225 --test 登录_0**
"""
ddt_cases = read_csv_data(csv_file_path)
......
......@@ -4,4 +4,4 @@ tunnels:
nat1:
remote_port: 31133
proto:
tcp: "192.168.1.109:80"
\ No newline at end of file
tcp: "192.168.1.225:80"
\ No newline at end of file
......@@ -16,7 +16,9 @@ logging.basicConfig(
"""
执行指令:
1.打开一个终端输入:python -m http.server 80 --directory reports
1.打开一个终端输入:
- cd 预定系统
- python -m http.server 80 --directory reports
2.打开新终端输入:
- cd .\预定系统\ngrok\
- .\start.bat
......
name,conference_name,message_name,book_type,issue_name,book_start_time,book_end_time,inside_participant_name,message_notification,notification_method,check_text
展厅巡检_001,展厅会议室,展厅巡检测试,普通会议,议题1,12:00,12:15,CZJ,开会前一天提醒,短信,预定成功
\ No newline at end of file
展厅巡检_001,展厅会议室,展厅巡检测试,普通会议,议题1,17:15,17:30,CZJ,开会前一天提醒,短信,预定成功
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论