def car3(): sleep(3) log("车次列表") id("com.mqunar.atom.bus:id/atom_bus_bt_search").click() log("汽车票预订") sleep(4) return id("com.mqunar.atom.bus:id/atom_bus_tv_next").get_attribute("text")
def car4(): sleep(3) log("车次详情") id("com.mqunar.atom.bus:id/atom_bus_tv_arr").click() #list=xpaths("//android.widget.RelativeLayout[@index='1']") #list.pop(4).click() return id("com.mqunar.atom.bus:id/atom_bus_tv_booking").get_attribute("text")
def car_main(): log("update") print("首页判断") sleep(10) key(4) sleep(3) print(id("com.mqunar.atom.alexhome:id/atom_alexhome_textview").get_attribute("text")) sleep(3) return id("com.mqunar.atom.alexhome:id/atom_alexhome_textview").get_attribute("text")
def car6(username,card): sleep(3) id("com.mqunar.atom.bus:id/et_passenger_name").clear() id("com.mqunar.atom.bus:id/et_passenger_name").send_keys(username) id("com.mqunar.atom.bus:id/et_passenger_card").clear() id("com.mqunar.atom.bus:id/et_passenger_card").send_keys(card)
def car5(): sleep(3) log("订单详情") id("com.mqunar.atom.bus:id/atom_bus_tv_booking").click() return id("com.mqunar.atom.bus:id/atom_bus_order_tv_main_title").get_attribute("text")
def car2(): sleep(3) log("买汽车票") id("com.mqunar.atom.alexhome:id/atom_alexhome_mod_bus_ticket").click() sleep(3) return xpath("//android.widget.Button[@text='搜 索']").get_attribute("text")
def login_qidongye(username, password): s = window_size() sleep(5) try: a = xpath("//android.widget.RelativeLayout[@index='0']") except Exception as rst: rst = 0 else: rst = 1 id("cn.sanfast.zhuoer.student:id/dialog_btn_cancel").click() try: b = xpath("//android.widget.LinearLayout[@index='0']") except Exception as ret: rst = 0 else: rst = 1 tap1() tap1() tap1() #id("com.android.packageinstaller:id/permission_allow_button").click() #id("com.android.packageinstaller:id/permission_allow_button").click() #id("com.android.packageinstaller:id/permission_allow_button").click() swip_up() sleep(2) swip_up() sleep(2) swip_up() sleep(2) #xpath("//android.widget.TextView[@text='进入主页']").click() #find_element("cn.sanfast.zhuoer.student:id/enter",20) tap() id("cn.sanfast.zhuoer.student:id/main_shopping").click() id("cn.sanfast.zhuoer.student:id/main_share").click() id("cn.sanfast.zhuoer.student:id/et_phone").click() id("cn.sanfast.zhuoer.student:id/et_phone").send_keys(username) id("cn.sanfast.zhuoer.student:id/et_password").send_keys(password) id("cn.sanfast.zhuoer.student:id/btn_login").click()
from logom import key,xpaths,id,xpath from time import sleep sleep(10) #key(4) key(4) id("com.mqunar.atom.alexhome:id/atom_alexhome_mod_bus_ticket").click() id("com.mqunar.atom.bus:id/atom_bus_bt_search").click() #xpath("//android.widget.Button[@text='搜 索']").click() id("com.mqunar.atom.bus:id/atom_bus_tv_arr").click() id("com.mqunar.atom.bus:id/atom_bus_tv_booking").click() id("com.mqunar.atom.bus:id/et_passenger_name").clear() id("com.mqunar.atom.bus:id/et_passenger_name").send_keys(username) id("com.mqunar.atom.bus:id/et_passenger_card").clear() id("com.mqunar.atom.bus:id/et_passenger_card").send_keys(card)
def login_ddenglu(username, password): s = window_size() sleep(5) id("cn.sanfast.zhuoer.student:id/main_shopping").click() id("cn.sanfast.zhuoer.student:id/main_share").click() id("cn.sanfast.zhuoer.student:id/et_phone").click() id("cn.sanfast.zhuoer.student:id/et_phone").send_keys(username) id("cn.sanfast.zhuoer.student:id/et_password").send_keys(password) id("cn.sanfast.zhuoer.student:id/btn_login").click() id("cn.sanfast.zhuoer.student:id/main_share").click() by_class("android.widget.TextView")