Ejemplo n.º 1
0
def test2():
    # driver = get_driver("com.cyanogenmod.filemanager", ".activities.NavigationActivity")
    action = BaseAction()
    # xpath = "text,全部选择"
    # print(action.xpath_revase(xpath))
    # xpath = "text,全部选择,0"
    # print(action.xpath_revase(xpath))
    # xpath = "text,全部选择,0","text,全部选择,1"
    # print(action.xpath_revase(xpath))
    xpath = ("text,全部选择,0"), ("text,全部选择")
    print(action.xpath_revase(xpath))
from selenium.webdriver.support.wait import WebDriverWait

from base.base_action import BaseAction

desired_caps = dict()
desired_caps['platformName'] = 'Android'
desired_caps['platformVersion'] = '5.1'
desired_caps['deviceName'] = '192.168.254.101:5555'
desired_caps['appPackage'] = 'com.android.settings'
desired_caps['appActivity'] = '.Settings'
# desired_caps['automationName'] = 'Uiautomator2'
# desired_caps['noReset'] = True
driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub', desired_caps)
driver.implicitly_wait(time_to_wait=10)

a = BaseAction(driver)


def just_swip(direction):
    print("当前页面没有要找的元素,进行滑动")
    # 获取手机的分辩率来后计算滑动距离,这样就能灵活适应大部分机型的分辨率到时候不用再修改代码
    width = driver.get_window_size()["width"]
    height = driver.get_window_size()["height"]

    # 计算出中间点方便运算
    center_x = width / 2
    center_y = height / 2

    left_x = width / 4 * 1
    left_y = center_y
    right_x = width / 4 * 3
Ejemplo n.º 3
0
def test_taost():
    # driver = get_driver("com.cyanogenmod.filemanager", ".activities.NavigationActivity")
    driver = get_driver()
    action = BaseAction(driver)
    action.back()
Ejemplo n.º 4
0
 def setup(self):
     self.driver = init_driver()
     self.networkPage = NetWorkPage(self.driver)
     self.baseAction = BaseAction(self.driver)