修改平差时找不到平差按钮就返回。

This commit is contained in:
2026-02-12 17:04:24 +08:00
parent 80fdc75c26
commit fbdbed37f4
8 changed files with 163 additions and 88 deletions

View File

@@ -5,6 +5,7 @@ from selenium.webdriver.support import expected_conditions as EC
from selenium.common.exceptions import TimeoutException, NoSuchElementException
import logging
import time
from datetime import datetime
from globals.driver_utils import launch_app_manually
from page_objects.login_page import LoginPage
@@ -179,12 +180,41 @@ class MoreDownloadPage:
try:
# # 获取年份选择器滚轮元素
# year_wheel = self.driver.find_element(AppiumBy.ID, "com.bjjw.cjgc:id/wheelView1")
# 获取当前日期
current_date = datetime.now()
current_month = current_date.month
# 检查月份是否小于等于3
if current_month <= 3:
self.logger.info(f"当前月份为{current_month}月,需要滑动年份选择器")
# 获取年份选择器滚轮元素
year_wheel = self.driver.find_element(AppiumBy.ID, "com.bjjw.cjgc:id/wheelView1")
# 获取滚轮的位置和尺寸
location = year_wheel.location
size = year_wheel.size
# 计算滚轮中心点坐标
center_x = location['x'] + size['width'] // 2
center_y = location['y'] + size['height'] // 2
# 计算滑动距离 - 滚轮高度的1/5
swipe_distance = size['height'] // 5
# 滑动一次年份选择器
# 执行滑动操作 - 从中心向上滑动1/5高度
self.driver.swipe(center_x, center_y - swipe_distance, center_x, center_y, 500)
self.logger.info("已滑动一次年份选择器")
else:
self.logger.info(f"当前月份为{current_month}月,不需要滑动年份选择器")
# 获取月份选择器滚轮元素
year_wheel = self.driver.find_element(AppiumBy.ID, "com.bjjw.cjgc:id/wheelView2")
month_wheel = self.driver.find_element(AppiumBy.ID, "com.bjjw.cjgc:id/wheelView2")
# 获取滚轮的位置和尺寸
location = year_wheel.location
size = year_wheel.size
location = month_wheel.location
size = month_wheel.size
# 计算滚轮中心点坐标
center_x = location['x'] + size['width'] // 2