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

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

上级 7be82109
...@@ -2,7 +2,7 @@ import csv ...@@ -2,7 +2,7 @@ import csv
import glob import glob
import re import re
import urllib import urllib
from selenium.webdriver.chrome.service import Service
import numpy as np import numpy as np
import requests import requests
import json import json
...@@ -68,7 +68,11 @@ def browser_init(login_url): ...@@ -68,7 +68,11 @@ def browser_init(login_url):
options.add_argument('--allow-insecure-localhost') options.add_argument('--allow-insecure-localhost')
# 使用webdriver_manager自动下载并管理chromedriver # 使用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实例并执行初始化操作 # 尝试创建WebDriver实例并执行初始化操作
try: try:
# 创建WebDriver实例 # 创建WebDriver实例
...@@ -764,3 +768,33 @@ def fetch_and_parse_check_txt(url, save_path, extract_info): ...@@ -764,3 +768,33 @@ def fetch_and_parse_check_txt(url, save_path, extract_info):
except requests.exceptions.RequestException as e: except requests.exceptions.RequestException as e:
logging.exception(f"请求错误: {e}") logging.exception(f"请求错误: {e}")
return None 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
...@@ -163,3 +163,5 @@ ...@@ -163,3 +163,5 @@
36. 2025-01-09 36. 2025-01-09
- 将手动执行adb连接的操作合并到程序中,并在每个adb连接设备模块执行完后断开对应设备的adb连接。处理可能因网络连接自动断开adb后无法进行远程app自动化操作的问题。 - 将手动执行adb连接的操作合并到程序中,并在每个adb连接设备模块执行完后断开对应设备的adb连接。处理可能因网络连接自动断开adb后无法进行远程app自动化操作的问题。
- 封装app自动化的初始化函数与清除函数,补充自动化adb连接设备以及判断。 - 封装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__)) ...@@ -10,19 +10,20 @@ current_dir = os.path.dirname(os.path.abspath(__file__))
sys.path.append(预定系统_path) sys.path.append(预定系统_path)
# 导入模块 # 导入模块
try: try:
from 预定系统.Base.app_base import *
from 预定系统.Base.base import * from 预定系统.Base.base import *
from 预定系统.Base.app_base import *
except ModuleNotFoundError as e: except ModuleNotFoundError as e:
print(f"ModuleNotFoundError: {e}") print(f"ModuleNotFoundError: {e}")
print("尝试使用绝对路径导入") print("尝试使用绝对路径导入")
from 预定系统.Base.app_base import *
from 预定系统.Base.base import * from 预定系统.Base.base import *
from 预定系统.Base.app_base import *
def suite_setup(): def suite_setup():
STEP(1, "初始化设备adb连接") STEP(1, "初始化设备adb连接")
device_ip = '192.168.5.112' device_ip = '192.168.5.112'
app_init(device_ip) app_init(device_ip)
login_url = "http://192.168.5.200:8080/#/login/logindf" login_url = "http://192.168.5.200:8080/#/login/logindf"
check_service_status("192.168.5.200", 8080)
browser_init(login_url) browser_init(login_url)
wd = GSTORE['wd'] wd = GSTORE['wd']
......
...@@ -10,13 +10,13 @@ current_dir = os.path.dirname(os.path.abspath(__file__)) ...@@ -10,13 +10,13 @@ current_dir = os.path.dirname(os.path.abspath(__file__))
sys.path.append(预定系统_path) sys.path.append(预定系统_path)
# 导入模块 # 导入模块
try: try:
from 预定系统.Base.app_base import *
from 预定系统.Base.base import * from 预定系统.Base.base import *
from 预定系统.Base.app_base import *
except ModuleNotFoundError as e: except ModuleNotFoundError as e:
print(f"ModuleNotFoundError: {e}") print(f"ModuleNotFoundError: {e}")
print("尝试使用绝对路径导入") print("尝试使用绝对路径导入")
from 预定系统.Base.app_base import *
from 预定系统.Base.base import * from 预定系统.Base.base import *
from 预定系统.Base.app_base import *
def suite_setup(): def suite_setup():
STEP(1, "初始化设备adb连接") STEP(1, "初始化设备adb连接")
...@@ -27,6 +27,6 @@ def suite_setup(): ...@@ -27,6 +27,6 @@ def suite_setup():
wd = GSTORE['wd'] wd = GSTORE['wd']
def suite_teardown(): def suite_teardown():
device_ip = '192.168.5.157' device_ip = '192.168.5.156'
app_quit(device_ip) app_quit(device_ip)
browser_quit() browser_quit()
\ No newline at end of file
...@@ -10,13 +10,13 @@ current_dir = os.path.dirname(os.path.abspath(__file__)) ...@@ -10,13 +10,13 @@ current_dir = os.path.dirname(os.path.abspath(__file__))
sys.path.append(预定系统_path) sys.path.append(预定系统_path)
# 导入模块 # 导入模块
try: try:
from 预定系统.Base.app_base import *
from 预定系统.Base.base import * from 预定系统.Base.base import *
from 预定系统.Base.app_base import *
except ModuleNotFoundError as e: except ModuleNotFoundError as e:
print(f"ModuleNotFoundError: {e}") print(f"ModuleNotFoundError: {e}")
print("尝试使用绝对路径导入") print("尝试使用绝对路径导入")
from 预定系统.Base.app_base import *
from 预定系统.Base.base import * from 预定系统.Base.base import *
from 预定系统.Base.app_base import *
def suite_setup(): def suite_setup():
STEP(1, "初始化设备adb连接") STEP(1, "初始化设备adb连接")
......
...@@ -68,7 +68,7 @@ start_workers(3) ...@@ -68,7 +68,7 @@ start_workers(3)
# 定义每天定时执行的任务 # 定义每天定时执行的任务
# 每天早上07:50执行后台系统设置功能测试 # 每天早上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="展厅巡检") 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 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,开会前一天提醒,预定成功 展厅巡检_001,展厅会议室,展厅巡检测试,普通会议,议题1,09:00,09:15,开会前一天提醒,预定成功
\ No newline at end of file \ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论