zoukankan      html  css  js  c++  java
  • app九宫格手势密码操作

    import time

    from appium.webdriver.common.touch_action import TouchAction
    from appium.webdriver import Remote
    caps={
    "platformName":"Android",
    "deviceName":"127.0.0.1:7555",
    "platformVersion":"6.0.1",
    "appPackage":"com.xxzb.fenwoo",
    "noSet":True,
    "appActivity":"com.xxzb.fenwoo.activity.addition.WelcomeActivity"
    }

    driver=Remote(command_executor='http://127.0.0.1:4723/wd/hub',desired_capabilities=caps)
    driver.implicitly_wait(20)
    # 直接跳转到手势密码设置的页面
    driver.start_activity('com.xxzb.fenwoo',".activity.user.CreateGesturePwdActivity")
    action=TouchAction(driver)
    time.sleep(2)
    button=driver.find_element_by_android_uiautomator('new UiSelector().className("android.widget.Button").textContains("确定").resourceId("com.xxzb.fenwoo:id/right_btn")')
    button.click()
    time.sleep(2)
    # 获取元素的起始坐标,元素的长度
    e=driver.find_element_by_android_uiautomator('new UiSelector().className("android.view.View").resourceId("com.xxzb.fenwoo:id/gesturepwd_create_lockview")')
    # 同时获取元素的起始点的x,y,height,width
    start_x = e.rect["x"]
    start_y = e.rect["y"]
    width = e.rect["width"]
    height = e.rect["height"]


    point1 = {"x": start_x + width * 1 / 6, "y": start_y + height * 1 / 6}
    point2 = {"x": start_x + width * 3 / 6, "y": start_y + height * 1 / 6}
    point3 = {"x": start_x + width * 5 / 6, "y": start_y + height * 1 / 6}
    point4 = {"x": start_x + width * 1 / 6, "y": start_y + height * 3 / 6}
    point5= {"x": start_x + width * 3 / 6, "y": start_y + height * 3 / 6}
    point6 = {"x": start_x + width * 5 / 6, "y": start_y + height * 3 / 6}
    point7= {"x": start_x + width * 1 / 6, "y": start_y + height * 5 / 6}
    point8= {"x": start_x + width * 3 / 6, "y": start_y + height * 5 / 6}
    point9 = {"x": start_x + width * 5 / 6, "y": start_y + height * 5 / 6}



    action.press(**point1).wait(10).move_to(
    **point2).wait(10).move_to(
    **point3).wait(10).move_to(
    **point5).wait(10).move_to(
    **point7).wait(10).move_to(
    **point8).wait(10).move_to(
    **point9).release().perform()


    time.sleep(10)
    driver.quit()
  • 相关阅读:
    工作后对单元测试学习的一点总结
    图片做按钮会将form表单自动提交
    转jMock Cookbook 中文版三
    转jMock Cookbook 中文版二
    转jMock Cookbook 中文版一
    JUnit4学习笔记(五):Theory(理论)测试
    JUnit4学习笔记(四):利用Rule扩展JUnit
    JUnit4学习笔记(三):assertThat语法与Matcher
    JUnit4学习笔记(二):参数化测试与假定(Assumption)
    junit学习一
  • 原文地址:https://www.cnblogs.com/fyangq/p/12673625.html
Copyright © 2011-2022 走看看