Commit 49630a73 by 杨基红

update login page

parent 030afcf2
import time
import warnings
from selenium import webdriver from selenium import webdriver
from appium import webdriver as appwebdriver
from selenium.webdriver.chrome.options import Options from selenium.webdriver.chrome.options import Options
# 尝试导入 appium,如果失败则设置为 None
appwebdriver = None
try:
from appium import webdriver as appwebdriver
except ImportError:
warnings.warn("Appium 模块未安装,移动端测试功能将不可用")
from config import appium_server_url, caps from config import appium_server_url, caps
...@@ -36,6 +43,8 @@ class DriverTools: ...@@ -36,6 +43,8 @@ class DriverTools:
# 打开app驱动 # 打开app驱动
@classmethod @classmethod
def get_app_driver(cls): def get_app_driver(cls):
if appwebdriver is None:
raise ImportError("Appium 模块未安装,无法初始化移动设备驱动")
if cls.__app_driver is None: if cls.__app_driver is None:
cls.__app_driver = appwebdriver.Remote(appium_server_url, caps) cls.__app_driver = appwebdriver.Remote(appium_server_url, caps)
cls.__app_driver.implicitly_wait(10) cls.__app_driver.implicitly_wait(10)
......
...@@ -28,7 +28,7 @@ class Login(BasePage): ...@@ -28,7 +28,7 @@ class Login(BasePage):
time.sleep(1) time.sleep(1)
self.find_ele(self.follow_password).send_keys(password) self.find_ele(self.follow_password).send_keys(password)
time.sleep(1) time.sleep(1)
self.find_ele(self.agree_box).click() # self.find_ele(self.agree_box).click()
self.find_ele(self.person_login).click() self.find_ele(self.person_login).click()
time.sleep(1) time.sleep(1)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment