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

处理因浏览器驱动自动更新造成自动化下载导致的驱动问题。目前改为手动指定chromedriver目录。

上级 7be82109
......@@ -2,7 +2,7 @@ import csv
import glob
import re
import urllib
from selenium.webdriver.chrome.service import Service
import numpy as np
import requests
import json
......@@ -68,7 +68,11 @@ def browser_init(login_url):
options.add_argument('--allow-insecure-localhost')
# 使用webdriver_manager自动下载并管理chromedriver
service = ChromeService(ChromeDriverManager().install())
# service = ChromeService(ChromeDriverManager().install())
# 使用备用的ChromeDriver下载源
# service = Service(ChromeDriverManager().install())
# 手动指定ChromeDriver的路径
service = Service(r'C:\Users\29194\AppData\Local\Programs\Python\Python310\Scripts\chromedriver.exe')
# 尝试创建WebDriver实例并执行初始化操作
try:
# 创建WebDriver实例
......@@ -763,4 +767,34 @@ def fetch_and_parse_check_txt(url, save_path, extract_info):
except requests.exceptions.RequestException as e:
logging.exception(f"请求错误: {e}")
return None
\ No newline at end of file
return None
import telnetlib
def check_service_status(host, port):
"""
检查服务状态。
通过尝试连接到指定的主机和端口来检查服务是否可用。
参数:
- host: 服务所在的主机地址。
- port: 服务监听的端口。
返回值:
"""
try:
# 创建Telnet对象并连接到服务器
tn = telnetlib.Telnet(host, port)
INFO(f"成功连接到 {host}:{port}")
# 可以在这里发送命令或读取响应
# 例如,读取服务器的欢迎信息
response = tn.read_until(b"\n", timeout=5)
INFO(f"服务器响应: {response.decode('ascii')}")
# 关闭连接
tn.close()
except Exception as e:
INFO(f"连接失败: {e}")
\ No newline at end of file
......@@ -162,4 +162,6 @@
- 增加窗帘下降后的等待时间再进行监控rtsp流截屏。
36. 2025-01-09
- 将手动执行adb连接的操作合并到程序中,并在每个adb连接设备模块执行完后断开对应设备的adb连接。处理可能因网络连接自动断开adb后无法进行远程app自动化操作的问题。
- 封装app自动化的初始化函数与清除函数,补充自动化adb连接设备以及判断。
\ No newline at end of file
- 封装app自动化的初始化函数与清除函数,补充自动化adb连接设备以及判断。
37. 2025-01-10
- 处理因浏览器驱动自动更新造成自动化下载导致的驱动问题。目前改为手动指定chromedriver目录。
\ No newline at end of file
......@@ -10,19 +10,20 @@ current_dir = os.path.dirname(os.path.abspath(__file__))
sys.path.append(预定系统_path)
# 导入模块
try:
from 预定系统.Base.app_base import *
from 预定系统.Base.base import *
from 预定系统.Base.app_base import *
except ModuleNotFoundError as e:
print(f"ModuleNotFoundError: {e}")
print("尝试使用绝对路径导入")
from 预定系统.Base.app_base import *
from 预定系统.Base.base import *
from 预定系统.Base.app_base import *
def suite_setup():
STEP(1, "初始化设备adb连接")
device_ip = '192.168.5.112'
app_init(device_ip)
login_url = "http://192.168.5.200:8080/#/login/logindf"
check_service_status("192.168.5.200", 8080)
browser_init(login_url)
wd = GSTORE['wd']
......
......@@ -10,13 +10,13 @@ current_dir = os.path.dirname(os.path.abspath(__file__))
sys.path.append(预定系统_path)
# 导入模块
try:
from 预定系统.Base.app_base import *
from 预定系统.Base.base import *
from 预定系统.Base.app_base import *
except ModuleNotFoundError as e:
print(f"ModuleNotFoundError: {e}")
print("尝试使用绝对路径导入")
from 预定系统.Base.app_base import *
from 预定系统.Base.base import *
from 预定系统.Base.app_base import *
def suite_setup():
STEP(1, "初始化设备adb连接")
......@@ -27,6 +27,6 @@ def suite_setup():
wd = GSTORE['wd']
def suite_teardown():
device_ip = '192.168.5.157'
device_ip = '192.168.5.156'
app_quit(device_ip)
browser_quit()
\ No newline at end of file
......@@ -10,13 +10,13 @@ current_dir = os.path.dirname(os.path.abspath(__file__))
sys.path.append(预定系统_path)
# 导入模块
try:
from 预定系统.Base.app_base import *
from 预定系统.Base.base import *
from 预定系统.Base.app_base import *
except ModuleNotFoundError as e:
print(f"ModuleNotFoundError: {e}")
print("尝试使用绝对路径导入")
from 预定系统.Base.app_base import *
from 预定系统.Base.base import *
from 预定系统.Base.app_base import *
def suite_setup():
STEP(1, "初始化设备adb连接")
......
......@@ -68,7 +68,7 @@ start_workers(3)
# 定义每天定时执行的任务
# 每天早上07:50执行后台系统设置功能测试
schedule.every().day.at("10:00").do(run_task, run_automation_test, report_title="预定系统_后台管理功能_测试报告", report_url_prefix="http://nat.ubainsyun.com:31133", test_case="预定系统功能", ding_type="标准版巡检")
# schedule.every().day.at("10:00").do(run_task, run_automation_test, report_title="预定系统_后台管理功能_测试报告", report_url_prefix="http://nat.ubainsyun.com:31133", test_case="预定系统功能", ding_type="标准版巡检")
schedule.every().day.at("07:50").do(run_task, run_automation_test, report_title="展厅巡检测试报告", report_url_prefix="http://nat.ubainsyun.com:31133", test_case="展厅巡检", ding_type="展厅巡检")
......
name,conference_name,message_name,book_type,issue_name,book_start_time,book_end_time,message_notification,check_text
展厅巡检_001,展厅会议室,展厅巡检测试,普通会议,议题1,08:15,08:30,开会前一天提醒,预定成功
\ No newline at end of file
展厅巡检_001,展厅会议室,展厅巡检测试,普通会议,议题1,09:00,09:15,开会前一天提醒,预定成功
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论