一、模型解析与目录设计:
![](https://i-blog.csdnimg.cn/blog_migrate/c4902aeb239422cf7400653d8fc7728e.png)
![](https://i-blog.csdnimg.cn/blog_migrate/031040d3a61c5b940e5efccfb6559cd5.png)
二、base目录与page目录关联:
三、 base目录下的其他函数:
![](https://i-blog.csdnimg.cn/blog_migrate/acd6bf129f29a7b4deb511b87b5b74b5.png)
四、page目录login.py下一些注意点:
最后源码:
base_page.py:
import os
import time
from appium import webdriver
from appium.webdriver.webdriver import By
from selenium.webdriver.support.wait import WebDriverWait
from appium.webdriver.common.touch_action import TouchAction
from selenium.webdriver import ActionChains
from selenium.webdriver.common.keys import Keys
import pytest
from xToolkit import xfile
import shutil
from pathlib import Path
import config
class BasePage:
def __init__(self,driver):
self.driver = driver
# 查找元素
def find_el_by_id(self,id,time =15,frequency=0.1):
return WebDriverWait(self.driver,time,frequency).until(
lambda x: x.find_element(By.ID, id) )
def find_el_by_uiautomator_text(self,el_text,time=18 , frequency=0.01):
return WebDriverWait(self.driver, time, frequency).until(
lambda x: x.find_element(By.ANDROID_UIAUTOMATOR, "new UiSelector().text(\"" + el_text + "\")"))
def find_el_by_u