Exemple #1
0
def loginApp(driver, buyCodePath):
    namePath = '/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.LinearLayout[2]/android.widget.LinearLayout[1]/android.widget.EditText'
    nameText = driver.find_element_by_xpath(namePath).text
    pwdPath = '/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.LinearLayout[2]/android.widget.LinearLayout[2]/android.widget.EditText'
    driver.find_element_by_xpath(pwdPath).click()
    sleep(1)
    account = getPwd('yiSheng')['account']
    if account in nameText:
        pwd = getPwd('yiSheng')['tradePwd']
        getKeyCode(driver, pwd)
        sleep(1)
        loginPath = '/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.LinearLayout[2]/android.widget.Button'
        driver.find_element_by_xpath(loginPath).click()
        sleep(1)
    else:
        pwd = getPwd('yiSheng')['logInPwd']
        getKeyCode(driver, pwd)
        sleep(1)
        loginPath = '/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.LinearLayout[2]/android.widget.Button'
        driver.find_element_by_xpath(loginPath).click()
        sleep(1)
        driver.find_element_by_xpath(buyCodePath).click()
        sleep(1)
        pwd = getPwd('yiSheng')['tradePwd']
        getKeyCode(driver, pwd)
        sleep(1)
        loginPath = '/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.LinearLayout[2]/android.widget.Button'
        driver.find_element_by_xpath(loginPath).click()
        sleep(1)
    driver.find_element_by_xpath(buyCodePath).click()
    sleep(1)
Exemple #2
0
def loginApp(driver, buyCodePath):
    typePath = '/hierarchy/android.widget.FrameLayout/android.widget.RelativeLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.Button[2]'
    if isExist(driver, 2, typePath):
        driver.find_element_by_xpath(typePath).click()
        sleep(1)
        pwdPath = '/hierarchy/android.widget.FrameLayout/android.widget.RelativeLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.FrameLayout[1]/android.widget.EditText'
        driver.find_element_by_xpath(pwdPath).click()
        sleep(1)
        pwd = getPwd('fangDe')['logInPwd']
        getKeyCode(driver, pwd)
        sleep(1)
        loginPath = '/hierarchy/android.widget.FrameLayout/android.widget.RelativeLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.Button'
        driver.find_element_by_xpath(loginPath).click()
        sleep(1)
        agreePath = '/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.Button[2]'
        driver.find_element_by_xpath(agreePath).click()
        sleep(1)
        driver.find_element_by_xpath(buyCodePath).click()
        sleep(1)
    tradePwdPath = '/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.LinearLayout[1]/android.widget.EditText'
    if isExist(driver, 2, tradePwdPath):
        driver.find_element_by_xpath(tradePwdPath).click()
        sleep(1)
        pwd = getPwd('fangDe')['tradePwd']
        getKeyCode(driver, pwd)
        sleep(1)
        loginPath = '/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.LinearLayout[2]/android.widget.Button'
        driver.find_element_by_xpath(loginPath).click()
        sleep(1)
Exemple #3
0
def loginYaoCai(driver):
    account = getPwd('yaoCai')['account']
    driver.find_elements_by_class_name('android.widget.EditText')[0].send_keys(
        account)
    logInPwd = getPwd('yaoCai')['logInPwd']
    driver.find_elements_by_class_name('android.widget.EditText')[1].send_keys(
        logInPwd)
    driver.find_element_by_id('com.brightsmart.android.etnet:id/login').click()
    sleep(10)
Exemple #4
0
def buyHuiLi(param):
    code = param['code']
    isCash = param['isCash']
    stockNumVal = param['numVal']
    isFinancingAll = param['isFinancingAll']
    isCashAll = param['isCashAll']
    settingIndex = param['setIndex']
    settingData = getSetting(settingIndex)
    settingData['appPackage'] = 'com.hk.poems.poemsMobileFX'
    settingData['appActivity'] = 'PoemsMobileTabActivity'
    desired_caps = settingData
    driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)
    driver.close_app()
    sleep(3)
    driver.launch_app()
    sleep(5)
    accountPath = '/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.TabHost/android.widget.RelativeLayout/android.widget.LinearLayout/android.widget.LinearLayout[2]/android.widget.LinearLayout[2]/android.widget.EditText[1]'
    driver.find_element_by_xpath(accountPath).clear()
    driver.find_element_by_xpath(accountPath).click()
    acount = getPwd('huiLi')['account']
    getKeyCode(driver, acount)
    sleep(1)
    pwdPath = '/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.TabHost/android.widget.RelativeLayout/android.widget.LinearLayout/android.widget.LinearLayout[2]/android.widget.LinearLayout[2]/android.widget.EditText[2]'
    driver.find_element_by_xpath(pwdPath).click()
    pwd = getPwd('huiLi')['logInPwd']
    getKeyCode(driver, pwd)
    sleep(1)
    loginPath = '/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.TabHost/android.widget.RelativeLayout/android.widget.LinearLayout/android.widget.LinearLayout[2]/android.widget.LinearLayout[4]/android.widget.LinearLayout[1]/android.widget.Button[2]'
    driver.find_element_by_xpath(loginPath).click()
    sleep(5)
    confirmKeyPath = '/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.Button'
    driver.find_element_by_xpath(confirmKeyPath).click()
    sleep(1)
    print(driver.page_source)
    keyPath = '/hierarchy/android.widget.FrameLayout/android.view.ViewGroup/android.widget.FrameLayout[2]/android.widget.RelativeLayout/android.widget.LinearLayout/android.widget.ListView/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.ImageButton'
    driver.find_element_by_xpath(keyPath).click()
    sleep(1)
    copyKeyPath = '/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.LinearLayout[2]/android.widget.ListView/android.widget.LinearLayout[1]/android.widget.RelativeLayout/android.widget.TextView'
    driver.find_element_by_xpath(copyKeyPath).click()
    sleep(1)
    confirmCopyPath = '/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.LinearLayout[2]/android.widget.Button[1]'
    driver.find_element_by_xpath(confirmCopyPath).click()
    sleep(5)
    acceptPath = '/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.Button[1]'
    driver.find_element_by_xpath(acceptPath).click()
    sleep(5)
    # driver.find_element_by_android_uiautomator('new UiSelector().text("我的")').click()
    # sleep(1)
    # driver.find_element_by_android_uiautomator('new UiSelector().text("认购新股")').click()
    # sleep(1)

    sleep(10)
Exemple #5
0
def loginApp(driver):
    pwdPath = '//android.widget.Button[@content-desc="login-trade-input-pwd"]'
    driver.find_element_by_xpath(pwdPath).click()
    sleep(1)
    pwd = getPwd('yiTaoJin')['tradePwd']
    getKeyCode(driver, pwd)
    sleep(1)
Exemple #6
0
def getZhangeLeProperty(param):
   settingIndex = param['setIndex']
   settingData = getSetting(settingIndex)
   settingData['appPackage'] = 'com.lphtsccft.zlqqt2'
   settingData['appActivity'] = 'com.lphtsccft.zhangle.startup.SplashScreenActivity'
   desired_caps = settingData
   driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)
   driver.close_app();            
   sleep(3)
   driver.launch_app(); 
   sleep(10)
   openZhangeLe(driver)
   driver.find_element_by_id('com.lphtsccft.zlqqt2:id/main_account').click()
   sleep(2)
   
   propertyPath = '/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.view.View/android.view.View/android.view.View/android.view.View[1]/android.widget.ScrollView/android.view.View/android.view.View/android.view.View/android.view.View[1]/android.view.View[5]'
   if isExist(driver, 2, propertyPath):
      driver.find_element_by_xpath(propertyPath).click()
      sleep(1)
      pwd = getPwd('zhangLe')['tradePwd']
      pwdId = 'com.lphtsccft.zlqqt2:id/login_et_password'
      driver.find_element_by_id(pwdId).send_keys(pwd)
      driver.find_element_by_id('com.lphtsccft.zlqqt2:id/login_btn_login_account').click()
   
   sleep(10)
Exemple #7
0
def loginZhangeLe(driver):
   pwd = getPwd('zhangLe')['tradePwd']
   pwdId = 'com.lphtsccft.zlqqt2:id/login_et_password'
   if isExist(driver, 4, pwdId):
      driver.find_element_by_id(pwdId).send_keys(pwd)
      driver.find_element_by_id('com.lphtsccft.zlqqt2:id/login_btn_login_account').click()

       
def buyChangQiao(param):
    code = param['code']
    codeName = param['codeName']
    isCash = param['isCash']
    stockNumVal = param['numVal']
    isFinancingAll = param['isFinancingAll']
    isCashAll = param['isCashAll']
    settingIndex = param['setIndex']
    settingData = getSetting(settingIndex)
    settingData['appPackage'] = 'global.longbridge.app.android'
    settingData['appActivity'] = 'global.longbridge.android.LaunchActivity'
    desired_caps = settingData
    driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)
    driver.close_app()
    sleep(3)
    driver.launch_app()
    sleep(5)
    driver.find_element_by_android_uiautomator(
        'new UiSelector().text("市场")').click()
    sleep(1)
    driver.find_element_by_android_uiautomator(
        'new UiSelector().text("IPO 专区")').click()
    sleep(1)
    print(driver.page_source)
    codeListPath = '/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.widget.RelativeLayout/android.view.ViewGroup/android.webkit.WebView/android.webkit.WebView/android.view.View/android.view.View[5]/android.widget.ListView'
    codeList = driver.find_elements_by_xpath(codeListPath)
    codeListLen = len(codeList)
    if codeListLen < 2:
        codeNameTextPath = '/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.widget.RelativeLayout/android.view.ViewGroup/android.webkit.WebView/android.webkit.WebView/android.view.View/android.view.View[5]/android.widget.ListView/android.view.View/android.view.View/android.view.View[2]/android.view.View[2]/android.widget.TextView'
        codeNameText = driver.find_element_by_xpath(codeNameTextPath).text
        print(codeNameText)
        if codeName in codeNameText:
            codeBuyPath = '/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.widget.RelativeLayout/android.view.ViewGroup/android.webkit.WebView/android.webkit.WebView/android.view.View/android.view.View[5]/android.widget.ListView/android.view.View/android.view.View/android.view.View[3]/android.widget.Button'
            driver.find_element_by_xpath(codeBuyPath).click()
            sleep(1)
    pwd = getPwd('changQiao')['tradePwd']
    getKeyCode(driver, pwd)
    sleep(1)
    numChoosePath = '/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.widget.RelativeLayout/android.view.ViewGroup/android.webkit.WebView/android.webkit.WebView/android.view.View/android.view.View/android.view.View[2]/android.view.View[2]/android.view.View[1]'
    driver.find_element_by_xpath(numChoosePath).click()
    sleep(1)
    if isFinancingAll:
        choosePath = '/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.widget.RelativeLayout/android.view.ViewGroup/android.webkit.WebView/android.webkit.WebView/android.view.View/android.view.View/android.view.View[2]/android.view.View[6]/android.widget.Button[2]'
    else:
        choosePath = '/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.widget.RelativeLayout/android.view.ViewGroup/android.webkit.WebView/android.webkit.WebView/android.view.View/android.view.View/android.view.View[2]/android.view.View[6]/android.widget.Button[1]'
    driver.find_element_by_xpath(choosePath).click()
    sleep(1)
    confirmPath = '/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.widget.RelativeLayout/android.view.ViewGroup/android.webkit.WebView/android.webkit.WebView/android.view.View/android.view.View/android.view.View[5]/android.view.View[3]/android.widget.Button'
    driver.find_element_by_xpath(confirmPath).click()
    sleep(1)
    driver.quit()
Exemple #9
0
def buyFuYuan(param):
    code = param['code']
    isCash = param['isCash']
    stockNumVal = param['numVal']
    isFinancingAll = param['isFinancingAll']
    isCashAll = param['isCashAll']
    settingIndex = param['setIndex']
    settingData = getSetting(settingIndex)
    settingData['appPackage'] = 'com.sunline.android.sunline'
    settingData['appActivity'] = '.DefaultAlias'
    desired_caps = settingData
    driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)
    driver.close_app()
    sleep(3)
    driver.launch_app()
    sleep(5)
    if isExist(driver, 4, 'com.sunline.android.sunline:id/cancel'):
        driver.find_element_by_id(
            'com.sunline.android.sunline:id/cancel').click()
        sleep(1)
    tipPath = 'new UiSelector().text("我知道了")'
    if isExist(driver, 1, tipPath):
        driver.find_element_by_android_uiautomator(tipPath).click()
        sleep(1)

    driver.find_element_by_android_uiautomator(
        'new UiSelector().text("交易")').click()
    sleep(2)
    driver.find_element_by_android_uiautomator(
        'new UiSelector().text("新股认购")').click()
    sleep(1)
    driver.find_element_by_android_uiautomator(
        'new UiSelector().text("可认购")').click()
    sleep(1)
    # contentPath = '/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.view.ViewGroup/android.view.ViewGroup/android.widget.LinearLayout[2]/android.support.v4.view.ViewPager/android.widget.ScrollView/android.widget.ViewSwitcher/android.widget.RelativeLayout/android.support.v7.widget.RecyclerView/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.RelativeLayout'
    # contentView = driver.find_element_by_xpath(contentPath)
    titlePath = '/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.view.ViewGroup/android.view.ViewGroup/android.widget.LinearLayout[2]/android.support.v4.view.ViewPager/android.widget.ScrollView/android.widget.ViewSwitcher/android.widget.RelativeLayout/android.support.v7.widget.RecyclerView/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.RelativeLayout/android.widget.RelativeLayout/android.widget.TextView[2]'
    title = driver.find_element_by_xpath(titlePath).text
    if code in title:
        buyPath = '/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.view.ViewGroup/android.view.ViewGroup/android.widget.LinearLayout[2]/android.support.v4.view.ViewPager/android.widget.ScrollView/android.widget.ViewSwitcher/android.widget.RelativeLayout/android.support.v7.widget.RecyclerView/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.RelativeLayout/android.widget.RelativeLayout/android.widget.Button'
        driver.find_element_by_xpath(buyPath).click()
        sleep(1)
    pwd = getPwd('fuYuan')['tradePwd']
    getKeyCode(driver, pwd)
    confirmId = 'com.sunline.android.sunline:id/btn_purchase'
    end = driver.find_element_by_id(confirmId).text
    print(end)

    sleep(20)
    driver.quit()
Exemple #10
0
def loginApp(driver, *others):
    pwdPath = '/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.widget.LinearLayout/android.widget.LinearLayout[1]/android.widget.LinearLayout/android.widget.EditText'
    if isExist(driver, 2, pwdPath):
        driver.find_element_by_xpath(pwdPath).click()
        sleep(1)
        pwd = getPwd('ruiFeng')['logInPwd']
        getKeyCode(driver, pwd)
        sleep(1)
        confirmPath = '/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.widget.LinearLayout/android.widget.Button'
        driver.find_element_by_xpath(confirmPath).click()
        sleep(2)
    if others:
        lastPath = others[0]
        if isExist(driver, 2, lastPath):
            driver.find_element_by_xpath(lastPath).click()
            sleep(1)
Exemple #11
0
def buyDongFang(param):
    code = param['code']
    isCash = param['isCash']
    stockNumVal = param['numVal']
    isFinancingAll = param['isFinancingAll']
    isCashAll = param['isCashAll']
    settingIndex = param['setIndex']
    settingData = getSetting(settingIndex)
    settingData['appPackage'] = 'hk.com.dfzq.dfyy'
    settingData['appActivity'] = 'com.tdx.Android.LaunchActivity'
    desired_caps = settingData

    # desired_caps = {
    #     'platformName':'Android',
    #     'platformVersion':'10',
    #     'deviceName':'2214c691',
    #     'appPackage':'hk.com.dfzq.dfyy',
    #     'noReset':True,
    #     'appActivity':'com.tdx.Android.LaunchActivity',
    # }
    driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)
    driver.close_app()
    sleep(3)
    driver.launch_app()
    sleep(5)
    driver.find_element_by_android_uiautomator(
        'new UiSelector().text("交易")').click()
    sleep(5)
    # driver.find_element_by_android_uiautomator('new UiSelector().text("已有交易账户,马上登录")').click()
    path = '/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.support.v4.widget.DrawerLayout/android.widget.LinearLayout/android.widget.RelativeLayout/android.widget.RelativeLayout[2]/android.support.v4.view.ViewPager/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.webkit.WebView/android.webkit.WebView/android.view.View/android.view.View[3]'
    driver.find_element_by_xpath(path).click()
    sleep(1)
    pwd = getPwd('dongFang')['tradePwd']
    driver.find_elements_by_class_name('android.widget.EditText')[1].send_keys(
        pwd)
    loginPath = '/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.support.v4.widget.DrawerLayout/android.widget.LinearLayout/android.widget.RelativeLayout/android.widget.RelativeLayout/android.widget.RelativeLayout/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.RelativeLayout[7]/android.view.View'
    driver.find_element_by_xpath(loginPath).click()
    sleep(1)
    agreePath = '/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.widget.RelativeLayout[3]/android.widget.LinearLayout/android.view.View[2]'
    driver.find_element_by_xpath(agreePath).click()
    sleep(6)
    driver.find_element_by_android_uiautomator(
        'new UiSelector().text("新股申购")').click()
    sleep(5)
Exemple #12
0
def getkey(param):
    settingIndex = param['setIndex']
    settingData = getSetting(settingIndex)
    settingData['appPackage'] = 'com.guodu.token'
    settingData[
        'appActivity'] = 'md58eeaaf6ecd101572fa448c5104fa33aa.BrokerListActivity'
    desired_caps = settingData
    driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)
    driver.close_app()
    sleep(3)
    driver.launch_app()
    sleep(6)
    pwd = getPwd('guoDu')['tradePwd']
    getKeyCode(driver, pwd)
    sleep(3)
    print(driver.page_source)
    driver.get_screenshot_as_file('./guodu.png')
    # screenshotBase64 = driver.get_screenshot_as_base64()
    # print(screenshotBase64)
    # keyLeftPath = '/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.ScrollView/android.widget.RelativeLayout/android.widget.LinearLayout[1]/android.widget.TextView[1]'
    # keyLeftId = 'com.guodu.token:id/token_left_textview'
    # # keyLeft = driver.find_element_by_xpath(keyLeftPath).text
    # keyLeft = driver.find_element_by_id(keyLeftId).text
    # print(keyLeft)
    # keyRightPath = '/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.ScrollView/android.widget.RelativeLayout/android.widget.LinearLayout[1]/android.widget.TextView[2]'
    # keyRightId = 'com.guodu.token:id/token_right_textview'
    # # keyRight = driver.find_element_by_xpath(keyRightPath).text
    # keyRight = driver.find_element_by_xpath(keyRightId).text
    # print(keyRight)
    # key = keyLeft + keyRight
    # print(key)
    # timePath = '/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.ScrollView/android.widget.RelativeLayout/android.widget.LinearLayout[2]/android.widget.FrameLayout/android.widget.TextView'
    # timeId = 'com.guodu.token:id/sec_textview'
    # time = driver.find_element_by_xpath(timeId).text
    # # time = driver.find_element_by_xpath(timePath).text
    # print(time)

    keyListPath = '/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.ScrollView/android.widget.RelativeLayout/android.widget.LinearLayout[1]/android.widget.TextView'
    keyList = driver.find_elements_by_xpath(keyListPath)
    print(len(keyList))
    for i in keyList:
        text = i.text
        print(text)
def getHuaShengTongProperty(param):
    settingIndex = param['setIndex']
    settingData = getSetting(settingIndex)
    settingData['appPackage'] = 'com.huasheng.stock'
    settingData['appActivity'] = 'com.hstong.app.launch.ui.Loading'
    desired_caps = settingData
    driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)
    driver.close_app()
    sleep(3)
    driver.launch_app()
    sleep(6)
    if isExist(driver, 4, 'com.huasheng.stock:id/button_cancel'):
        driver.find_element_by_id(
            'com.huasheng.stock:id/button_cancel').click()
    if isExist(driver, 4, 'com.huasheng.stock:id/btn_close'):
        driver.find_element_by_id('com.huasheng.stock:id/btn_close').click()
    driver.find_element_by_android_uiautomator(
        'new UiSelector().text("交易")').click()
    sleep(1)
    if isExist(driver, 3, 'android.widget.EditText'):
        pwd = getPwd('huaShengTong')['tradePwd']
        driver.find_element_by_class_name('android.widget.EditText').send_keys(
            pwd)
        driver.find_element_by_id('com.huasheng.stock:id/btn_login').click()
        sleep(5)
    allPath = '/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/androidx.viewpager.widget.ViewPager/android.view.ViewGroup/android.widget.LinearLayout/androidx.recyclerview.widget.RecyclerView/android.widget.LinearLayout/android.widget.RelativeLayout/android.widget.TextView[2]'
    allNum = driver.find_element_by_xpath(allPath).text
    availablePath = '/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/androidx.viewpager.widget.ViewPager/android.view.ViewGroup/android.widget.LinearLayout/androidx.recyclerview.widget.RecyclerView/android.widget.LinearLayout/android.widget.FrameLayout[1]/android.view.ViewGroup/android.widget.LinearLayout[2]/android.widget.TextView[2]'
    availableNum = driver.find_element_by_xpath(availablePath).text
    param = {
        'method': 0,
        'tableName': 'huaShengTong0',
        'allNum': allNum,
        'availableNum': availableNum,
    }
    initMysql(param)
    driver.quit()
    print(allNum)
    print(availableNum)
def buyHuaShengTong(param):
    code = param['code']
    isCash = param['isCash']
    stockNumVal = param['numVal']
    isFinancingAll = param['isFinancingAll']
    isCashAll = param['isCashAll']
    settingIndex = param['setIndex']
    settingData = getSetting(settingIndex)
    settingData['appPackage'] = 'com.huasheng.stock'
    settingData['appActivity'] = 'com.hstong.app.launch.ui.Loading'
    desired_caps = settingData

    # desired_caps = {
    #     'platformName':'Android',
    #     'platformVersion':'10',
    #     'deviceName':'2214c691',
    #     'appPackage':'com.huasheng.stock',
    #     'noReset':True,
    #     'appActivity':'com.hstong.app.launch.ui.Loading',
    # }
    driver = webdriver.Remote('http://*****:*****@text, "' + code + '")]'
    codePath = '//android.widget.TextView[contains(@text, "' + code + '")]/parent::*/parent::*/parent::*/following-sibling::android.widget.LinearLayout[4]/android.widget.TextView'
    if isExist(driver, 2, codeExitPath):
        codeBtn = driver.find_element_by_xpath(codePath)
        codeBtn.click()
        sleep(8)
    print(driver.page_source)

    if not isCash:

        financingPath = '/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.view.ViewGroup/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.FrameLayout/com.tencent.tbs.core.webkit.WebView/android.webkit.WebView/android.view.View/android.view.View[1]/android.view.View/android.view.View[2]/android.widget.ListView[1]/android.view.View[2]'
        driver.find_element_by_xpath(financingPath).click()
        sleep(1)

    choosePath = '/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.view.ViewGroup/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.FrameLayout/com.tencent.tbs.core.webkit.WebView/android.webkit.WebView/android.view.View/android.view.View[1]/android.view.View/android.view.View[2]/android.view.View[2]'
    driver.find_element_by_xpath(choosePath).click()
    sleep(1)
    maxExistPath = '//android.view.View[contains(@text, "存入资金")]'
    if isCashAll or isFinancingAll:
        while not isExist(driver, 2, maxExistPath):
            driver.swipe(200, 1600, 200, 1300, 300)
        maxPath = '//android.view.View[contains(@text, "存入资金")]/parent::*/parent::*/preceding-sibling::android.view.View[1]/android.view.View'
        driver.find_element_by_xpath(maxPath).click()
        sleep(1)
    else:
        num = str(numFromStr(stockNumVal))
        numPath = '/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.view.ViewGroup/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.FrameLayout/com.tencent.tbs.core.webkit.WebView/android.webkit.WebView/android.view.View/android.view.View/android.view.View[4]/android.view.View/android.widget.ListView[2]/android.view.View[' + num + ']/android.view.View[1]'
        driver.find_element_by_xpath(numPath).click()
        sleep(1)
    finishPath = '/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.view.ViewGroup/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.FrameLayout/com.tencent.tbs.core.webkit.WebView/android.webkit.WebView/android.view.View/android.view.View[2]/android.view.View[2]'
    driver.find_element_by_xpath(finishPath).click()
    sleep(2)
    agreePath = '/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.view.ViewGroup/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.FrameLayout/com.tencent.tbs.core.webkit.WebView/android.webkit.WebView/android.view.View/android.view.View[2]/android.view.View[1]/android.view.View/android.view.View[1]'
    agreeBox = driver.find_element_by_xpath(agreePath)
    agreeBox.click()
    confirmPath = '/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.view.ViewGroup/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.FrameLayout/com.tencent.tbs.core.webkit.WebView/android.webkit.WebView/android.view.View/android.view.View[2]/android.view.View[2]'
    driver.find_element_by_xpath(confirmPath).click()
    sleep(5)
    driver.quit()
Exemple #15
0
def buyZunJia(param):
    code = param['code']
    isCash = param['isCash']
    stockNum = param['num']
    # stockNumVal = param['numVal']
    isFinancingAll = param['isFinancingAll']
    isCashAll = param['isCashAll']
    settingIndex = param['setIndex']
    settingData = getSetting(settingIndex)
    settingData['appPackage'] = 'com.juniorchina.jcstock'
    settingData['appActivity'] = '.SplashActivity'
    desired_caps = settingData

    # desired_caps = {
    #     'platformName':'Android',
    #     'platformVersion':'10',
    #     'deviceName':'2214c691',
    #     'appPackage':'com.juniorchina.jcstock',
    #     'noReset':True,
    #     'appActivity':'.SplashActivity',
    #     # 'newCommandTimeout':0,
    #     'automationName':'uiautomator2'
    # }

    driver = webdriver.Remote('http://*****:*****@text,"(' + code + '.HK)")]/parent::*/following-sibling::android.widget.LinearLayout[1]/android.widget.RelativeLayout/android.widget.TextView'
    if isExist(driver, 2, buyPath):
        driver.find_element_by_xpath(buyPath).click()
        sleep(1)
        if not isCash:
            driver.find_element_by_id(
                'com.juniorchina.jcstock:id/iv_margin').click()
            sleep(1)
        if isCashAll or isFinancingAll:
            maxPath = '//android.widget.TextView[@text="可用资金不足"]/parent::*/parent::*/preceding-sibling::android.widget.LinearLayout[1]/android.widget.LinearLayout/android.widget.TextView'
            maxExistPath = '//*[@text="可用资金不足"]'
            while not isExist(driver, 2, maxExistPath):
                driver.swipe(200, 500, 200, 100, 300)
            maxView = driver.find_element_by_xpath(maxPath)
            maxNum = maxView.text
            maxView.click()
        else:
            numPath = 'new UiSelector().textContains("%d")' % (stockNum)
            if isExist(driver, 1, numPath):
                driver.find_element_by_android_uiautomator(numPath).click()
                sleep(1)
        driver.find_element_by_id('com.juniorchina.jcstock:id/tv_ok').click()
        # driver.find_element_by_id('com.juniorchina.jcstock:id/tv_cancel').click()
    pwd = getPwd('zunJia')['tradePwd']
    driver.find_element_by_id(
        'com.juniorchina.jcstock:id/et_password').send_keys(pwd)
    driver.find_element_by_id(
        'com.juniorchina.jcstock:id/layout_commit').click()

    sleep(3)
    driver.quit()
Exemple #16
0
def buyFuTu(param):
    code = param['code']
    isCash = param['isCash']
    # stockNum = param['num']
    stockNumVal = param['numVal']
    isFinancingAll = param['isFinancingAll']
    isCashAll = param['isCashAll']
    settingIndex = param['setIndex']
    settingData = getSetting(settingIndex)
    settingData['appPackage'] = 'cn.futu.trader'
    settingData['appActivity'] = '.launch.activity.LaunchActivity'
    desired_caps = settingData
    driver = webdriver.Remote('http://*****:*****@text="' + code + '"]/parent::*/parent::*/following-sibling::android.widget.RelativeLayout/android.widget.TextView'
    if isExist(driver, 2, buyPath):
        driver.find_element_by_xpath(buyPath).click()
        sleep(4)
        print(driver.page_source)
        financeTimePath = '/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.webkit.WebView/android.webkit.WebView/android.view.View/android.view.View[3]/android.view.View[4]'
        financingPath = '/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.webkit.WebView/android.webkit.WebView/android.view.View/android.view.View[1]/android.view.View[3]/android.view.View[26]/android.view.View[5]/android.view.View/android.view.View[5]/android.view.View'
        cashPath = '/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.webkit.WebView/android.webkit.WebView/android.view.View/android.view.View[1]/android.view.View[3]/android.view.View[26]/android.view.View[4]/android.view.View/android.view.View[3]/android.view.View'
        cashNextPath = '/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.webkit.WebView/android.webkit.WebView/android.view.View/android.view.View[1]/android.view.View[3]/android.view.View[27]/android.view.View[4]/android.view.View/android.view.View[3]/android.view.View'
        financingNextPath = '/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.webkit.WebView/android.webkit.WebView/android.view.View/android.view.View[1]/android.view.View[3]/android.view.View[27]/android.view.View[5]/android.view.View/android.view.View[5]/android.view.View'
        tipPath = '/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.webkit.WebView/android.webkit.WebView/android.view.View/android.view.View[1]/android.view.View[3]/android.view.View[2]'
        nextFlag = False
        if isExist(driver, 2, cashNextPath):
            cashPath = cashNextPath
            financingPath = financingNextPath
            nextFlag = True
        if isExist(driver, 2, cashPath):
            if not isCash:
                if isExist(driver, 2, financingPath):
                    financingBtn = driver.find_element_by_xpath(financingPath)
                    financingBtn.click()
                    sleep(1)

            else:
                cashBtn = driver.find_element_by_xpath(cashPath)
                cashFlag = cashBtn.get_attribute('checked')
                if not cashFlag:
                    cashBtn.click()
                    sleep(1)

            if nextFlag:
                otherPath = '/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.webkit.WebView/android.webkit.WebView/android.view.View/android.view.View[1]/android.view.View[3]/android.view.View[22]'
            else:
                otherPath = '/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.webkit.WebView/android.webkit.WebView/android.view.View/android.view.View[1]/android.view.View[3]/android.view.View[21]'
            driver.find_element_by_xpath(otherPath).click()
            sleep(1)
            num = str(4 + 2 * numFromStr(stockNumVal))
            if isCashAll:
                if nextFlag:
                    cashAllPath = '/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.webkit.WebView/android.webkit.WebView/android.view.View/android.view.View[1]/android.view.View[3]/android.view.View[26]/android.view.View[1]/android.view.View/android.view.View[4]/android.view.View[2]'
                else:
                    cashAllPath = '/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.webkit.WebView/android.webkit.WebView/android.view.View/android.view.View[1]/android.view.View[3]/android.view.View[25]/android.view.View[1]/android.view.View/android.view.View[4]/android.view.View[2]'
                driver.find_element_by_xpath(cashAllPath).click()
                sleep(1)
            elif isFinancingAll:
                if nextFlag:
                    finacingAllPath = '/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.webkit.WebView/android.webkit.WebView/android.view.View/android.view.View[1]/android.view.View[3]/android.view.View[26]/android.view.View[1]/android.view.View/android.view.View[4]/android.view.View[3]'
                else:
                    finacingAllPath = '/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.webkit.WebView/android.webkit.WebView/android.view.View/android.view.View[1]/android.view.View[3]/android.view.View[25]/android.view.View[1]/android.view.View/android.view.View[4]/android.view.View[3]'
                driver.find_element_by_xpath(finacingAllPath).click()
                sleep(1)

            else:
                if nextFlag:
                    numPath = '/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.webkit.WebView/android.webkit.WebView/android.view.View/android.view.View[1]/android.view.View[3]/android.view.View[26]/android.view.View[1]/android.view.View/android.view.View[3]/android.view.View[2]/android.view.View[' + num + ']/android.view.View[1]/android.widget.TextView'
                else:
                    numPath = '/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.webkit.WebView/android.webkit.WebView/android.view.View/android.view.View[1]/android.view.View[3]/android.view.View[25]/android.view.View[1]/android.view.View/android.view.View[3]/android.view.View[2]/android.view.View[' + num + ']/android.view.View[1]/android.widget.TextView'
                driver.find_element_by_xpath(numPath).click()
                sleep(1)

            nextStepPath = '/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.webkit.WebView/android.webkit.WebView/android.view.View/android.view.View[1]/android.view.View[3]/android.view.View[31]/android.view.View[2]/android.view.View[2]/android.view.View[5]'
            driver.find_element_by_xpath(nextStepPath).click()
            sleep(2)
            agreePath = '/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.webkit.WebView/android.webkit.WebView/android.view.View/android.view.View[1]/android.view.View[34]/android.view.View[3]/android.view.View/android.view.View[1]'
            driver.find_element_by_xpath(agreePath).click()
            sleep(1)
            finishPath = '/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.webkit.WebView/android.webkit.WebView/android.view.View/android.view.View[1]/android.view.View[35]/android.view.View[2]'
            # finishBtn = driver.find_element_by_xpath(finishPath)
            driver.find_element_by_xpath(finishPath).click()
            sleep(2)
            print(driver.page_source)
            pwd = getPwd('fuTu')['tradePwd']
            for i in pwd:
                index = i
                if i == '0':
                    index = 11
                pwdPath = '/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.webkit.WebView/android.webkit.WebView/android.view.View/android.view.View[1]/android.view.View[35]/android.view.View[1]/android.view.View[2]/android.view.View/android.view.View/android.widget.ListView/android.view.View[' + index + ']'
                driver.find_element_by_xpath(pwdPath).click()
                sleep(1)

        elif isExist(driver, 2, financeTimePath):
            financingTime = driver.find_element_by_xpath(financeTimePath)
            text = financingTime.get_attribute('text')
            print(text)
    sleep(5)
    driver.quit()
Exemple #17
0
def buyFuTu(param):
    code = param['code']
    isCash = param['isCash']
    # stockNum = param['num']
    stockNumVal = param['numVal']
    # isFinancingAll = param['isFinancingAll']
    isCashAll = param['isCashAll']
    settingIndex = param['setIndex']
    settingData = getSetting(settingIndex)
    settingData['appPackage'] = 'cn.futu.trader'
    settingData['appActivity'] = '.launch.activity.LaunchActivity'
    desired_caps = settingData
    # desired_caps = {
    #     'platformName':'Android',
    #     'platformVersion':'10',
    #     'deviceName':'2214c691',
    #     'appPackage':'cn.futu.trader',
    #     'noReset':True,
    #     'appActivity':'.launch.activity.LaunchActivity'
    # }
    driver = webdriver.Remote('http://*****:*****@text="' + code + '"]/parent::*/parent::*/following-sibling::android.widget.RelativeLayout/android.widget.TextView'
    if isExist(driver, 2, buyPath):
        driver.find_element_by_xpath(buyPath).click()
        sleep(4)
        print(driver.page_source)
        print(driver.contexts)
        financeTimePath = '/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.webkit.WebView/android.webkit.WebView/android.view.View/android.view.View[3]/android.view.View[4]'
        financingPath = '/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.webkit.WebView/android.webkit.WebView/android.view.View/android.view.View[1]/android.view.View[3]/android.view.View[26]/android.view.View[5]/android.view.View/android.view.View[5]/android.view.View'
        cashPath = '/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.webkit.WebView/android.webkit.WebView/android.view.View/android.view.View[1]/android.view.View[3]/android.view.View[26]/android.view.View[4]/android.view.View/android.view.View[3]/android.view.View'
        # financingDisablePath = '/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.webkit.WebView/android.webkit.WebView/android.view.View/android.view.View[1]/android.view.View[3]/android.view.View[26]/android.view.View[5]/android.view.View/android.view.View[4]/android.view.View'
        if isExist(driver, 2, cashPath):
            if not isCash:
                if isExist(driver, 2, financingPath):
                    financingBtn = driver.find_element_by_xpath(financingPath)
                    financingBtn.click()
                    sleep(1)

            else:
                cashBtn = driver.find_element_by_xpath(cashPath)
                cashFlag = cashBtn.get_attribute('checked')
                if not cashFlag:
                    cashBtn.click()
                    sleep(1)

            otherPath = '/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.webkit.WebView/android.webkit.WebView/android.view.View/android.view.View[1]/android.view.View[3]/android.view.View[21]'
            driver.find_element_by_xpath(otherPath).click()
            sleep(1)
            num = str(4 + 2 * numFromStr(stockNumVal))
            if isCashAll:
                cashAllPath = '/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.webkit.WebView/android.webkit.WebView/android.view.View/android.view.View[1]/android.view.View[3]/android.view.View[25]/android.view.View[1]/android.view.View/android.view.View[4]/android.view.View[2]'
                driver.find_element_by_xpath(cashAllPath).click()
                sleep(1)
            else:
                numPath = '/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.webkit.WebView/android.webkit.WebView/android.view.View/android.view.View[1]/android.view.View[3]/android.view.View[25]/android.view.View[1]/android.view.View/android.view.View[3]/android.view.View[2]/android.view.View[' + num + ']/android.view.View[1]/android.widget.TextView'
                driver.find_element_by_xpath(numPath).click()
                sleep(1)
            nextStepPath = '/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.webkit.WebView/android.webkit.WebView/android.view.View/android.view.View[1]/android.view.View[3]/android.view.View[31]/android.view.View[2]/android.view.View[2]/android.view.View[5]'
            driver.find_element_by_xpath(nextStepPath).click()
            sleep(2)
            agreePath = '/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.webkit.WebView/android.webkit.WebView/android.view.View/android.view.View[1]/android.view.View[34]/android.view.View[3]/android.view.View/android.view.View[1]'
            driver.find_element_by_xpath(agreePath).click()
            sleep(1)
            finishPath = '/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.webkit.WebView/android.webkit.WebView/android.view.View/android.view.View[1]/android.view.View[35]/android.view.View[2]'
            # finishBtn = driver.find_element_by_xpath(finishPath)
            driver.find_element_by_xpath(finishPath).click()
            sleep(2)
            print(driver.page_source)
            pwd = getPwd('fuTu')['tradePwd']
            print(pwd[0])
            os.system(
                'adb shell ime set com.sohu.inputmethod.sogou.xiaomi/.SogouIME'
            )
            # os.system('adb shell ime set io.appium.settings/.UnicodeIME')
            # os.system('adb shell ime set com.iflytek.inputmethod.miui/.FlyIME')
            # os.system('adb shell ime set com.baidu.input_mi/.ImeService')

            pwdPatha = '/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.webkit.WebView/android.webkit.WebView/android.view.View/android.view.View[1]/android.view.View[35]/android.view.View[1]/android.view.View[2]/android.view.View/android.widget.ListView/android.view.View[1]'
            driver.find_element_by_xpath(pwdPatha).click()
            driver.press_keycode(144)
            # driver.find_element_by_xpath(pwdPatha).set_value(3)
            # pwdPathb = '/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.webkit.WebView/android.webkit.WebView/android.view.View/android.view.View[1]/android.view.View[35]/android.view.View[1]/android.view.View[2]/android.view.View/android.widget.ListView/android.view.View[2]'
            # driver.find_element_by_xpath(pwdPathb).click()
            # driver.press_keycode(10)
        elif isExist(driver, 2, financeTimePath):
            financingTime = driver.find_element_by_xpath(financeTimePath)
            text = financingTime.get_attribute('text')
            print(text)

    sleep(5)
    driver.quit()
Exemple #18
0
def buyAErFa(param):
    code = param['code']
    isCash = param['isCash']
    stockNumVal = param['numVal']
    stockNum = param['num']
    isFinancingAll = param['isFinancingAll']
    isCashAll = param['isCashAll']
    settingIndex = param['setIndex']
    settingData = getSetting(settingIndex)
    settingData['appPackage'] = 'com.hkbeiniu.securities'
    settingData['appActivity'] = '.home.activity.UPHKLauncherActivity'
    desired_caps = settingData
    driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)
    driver.close_app()
    sleep(3)
    driver.launch_app()
    sleep(5)
    driver.find_element_by_android_uiautomator(
        'new UiSelector().text("交易")').click()
    sleep(1)
    initApp(driver)
    driver.find_element_by_android_uiautomator(
        'new UiSelector().text("新股中心")').click()
    sleep(2)
    driver.find_element_by_android_uiautomator(
        'new UiSelector().text("可认购")').click()
    sleep(2)
    codeListPath = '/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/androidx.viewpager.widget.ViewPager/android.widget.RelativeLayout/android.view.ViewGroup/android.widget.FrameLayout/androidx.recyclerview.widget.RecyclerView/android.widget.LinearLayout'
    codeList = driver.find_elements_by_xpath(codeListPath)
    if len(codeList) < 2:
        codePath = '/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/androidx.viewpager.widget.ViewPager/android.widget.RelativeLayout/android.view.ViewGroup/android.widget.FrameLayout/androidx.recyclerview.widget.RecyclerView/android.widget.LinearLayout/android.widget.RelativeLayout/android.widget.TextView[2]'
        codeText = driver.find_element_by_xpath(codePath).text
        print(codeText)
        if code in codeText:
            buyPath = '/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/androidx.viewpager.widget.ViewPager/android.widget.RelativeLayout/android.view.ViewGroup/android.widget.FrameLayout/androidx.recyclerview.widget.RecyclerView/android.widget.LinearLayout/android.widget.TextView'
            driver.find_element_by_xpath(buyPath).click()
            sleep(1)
    if not isCash:
        typePath = '/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/androidx.viewpager.widget.ViewPager/android.widget.RelativeLayout/android.view.ViewGroup/android.widget.FrameLayout/android.widget.ScrollView/android.widget.LinearLayout/android.widget.LinearLayout[6]/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.TextView'
        driver.find_element_by_xpath(typePath).click()
        sleep(1)
        financePath = '/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.ListView/android.widget.LinearLayout[2]/android.widget.TextView'
        driver.find_element_by_xpath(financePath).click()
        sleep(1)
        financeRatioPath = '/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/androidx.viewpager.widget.ViewPager/android.widget.RelativeLayout/android.view.ViewGroup/android.widget.FrameLayout/android.widget.ScrollView/android.widget.LinearLayout/android.widget.LinearLayout[7]/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.TextView'
        driver.find_element_by_xpath(financeRatioPath).click()
        sleep(1)

        financeRatioFlag = True
        while financeRatioFlag:
            financeRatioListPath = '/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.ListView/android.widget.LinearLayout/android.widget.TextView'
            financeRatioList = driver.find_elements_by_xpath(
                financeRatioListPath)
            financeRatioListLen = len(financeRatioList)
            for i in range(financeRatioListLen):
                ratioText = financeRatioList[i].text
                if '90' in ratioText:
                    financeRatioFlag = False
                    ratioEndPath = '/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.ListView/android.widget.LinearLayout[5]/android.widget.TextView'
                    driver.find_element_by_xpath(ratioEndPath).click()
                    sleep(1)

            if financeRatioFlag:
                driver.swipe(400, 1500, 400, 1000, 300)
    numPath = '/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/androidx.viewpager.widget.ViewPager/android.widget.RelativeLayout/android.view.ViewGroup/android.widget.FrameLayout/android.widget.ScrollView/android.widget.LinearLayout/android.widget.LinearLayout[2]/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.TextView'
    numText = driver.find_element_by_xpath(numPath).text
    if stockNum not in numText:
        driver.find_element_by_xpath(numPath).click()
        sleep(1)
        numFlag = True
        while numFlag:
            numListPath = '/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.ListView/android.widget.LinearLayout/android.widget.TextView'
            numList = driver.find_elements_by_xpath(numListPath)
            numLen = len(numList)
            for i in range(numLen):
                numText = numList[i].text
                if stockNum in numText:
                    numFlag = False
                    index = str(i + 1)
                    numConfirmPath = '/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.ListView/android.widget.LinearLayout[ ' + index + ']/android.widget.TextView'
                    driver.find_element_by_xpath(numConfirmPath).click()
                    sleep(1)

            if numFlag:
                driver.swipe(400, 660, 400, 550, 300)
    confimPath = '/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/androidx.viewpager.widget.ViewPager/android.widget.RelativeLayout/android.widget.Button'
    driver.find_element_by_xpath(confimPath).click()
    sleep(1)
    pwd = getPwd('youYu')['tradePwd']
    print(pwd)
    getKeyCode(driver, pwd)
    sleep(1)
    driver.quit()
Exemple #19
0
def buyDongCai(param):
    code = param['code']
    isCash = param['isCash']
    stockNum = param['num']
    # stockNumVal = param['numVal']
    isFinancingAll = param['isFinancingAll']
    isCashAll = param['isCashAll']
    settingIndex = param['setIndex']
    settingData = getSetting(settingIndex)
    settingData['appPackage'] = 'com.eastmoney.android.lead'
    settingData[
        'appActivity'] = 'com.eastmoney.android.berlin.activity.MainActivity'
    desired_caps = settingData
    driver = webdriver.Remote('http://*****:*****@text, "认购中")]').click()
    sleep(1)
    codeText = 'new UiSelector().text("' + code + '")'
    codeParentView = driver.find_element_by_android_uiautomator(
        codeText).parent
    codeParentView.find_element_by_android_uiautomator(
        'new UiSelector().text("认购")').click()
    sleep(1)
    pwd = getPwd('dongCai')['tradePwd']
    print(pwd)
    getKeyCode(driver, pwd)
    sleep(3)
    if isCash:
        cashText = 'new UiSelector().text("现金")'
        driver.find_element_by_android_uiautomator(cashText).click()
    amountChooseUi = 'new UiSelector().text("请选择认购股数")'
    driver.find_element_by_android_uiautomator(amountChooseUi).click()
    sleep(1)

    amountFlag = True
    amountCheckIndex = ''
    while amountFlag:
        amountViewPath = '/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup[2]/android.view.ViewGroup[2]/android.view.ViewGroup[2]/android.view.ViewGroup/android.widget.ScrollView/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup'
        amountView = driver.find_elements_by_xpath(amountViewPath)
        amountLen = len(amountView) - 1
        print(amountLen)
        for i in range(amountLen):
            index = str(i + 1)
            print(index)
            if isCashAll:
                amountOutText = '/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup[2]/android.view.ViewGroup[2]/android.view.ViewGroup[2]/android.view.ViewGroup/android.widget.ScrollView/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup[' + index + ']/android.view.ViewGroup/android.widget.TextView[2]'
                if isExist(driver, 2, amountOutText):
                    amountFlag = False
                    amountCheckIndex = str(i)
                    break
            elif isCash:
                amountTextPath = '/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup[2]/android.view.ViewGroup[2]/android.view.ViewGroup[2]/android.view.ViewGroup/android.widget.ScrollView/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup[' + index + ']/android.view.ViewGroup/android.widget.TextView'
                amountText = driver.find_element_by_xpath(amountTextPath).text
                if stockNum in amountText:
                    amountFlag = False
                    amountCheckIndex = str(i + 1)
                    break
            elif isFinancingAll:
                testUi = 'new UiSelector().textContains("不足")'
                if isExist(amountView[i], 1, testUi):
                    test = amountView[i].find_element_by_android_uiautomator(
                        'new UiSelector().textContains("不足")').text
                    print(test)
                    amountFlag = False
                    amountCheckIndex = str(i)
                    break
            else:
                amountTextPath = '/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup[2]/android.view.ViewGroup[2]/android.view.ViewGroup[2]/android.view.ViewGroup/android.widget.ScrollView/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup[' + index + ']/android.view.ViewGroup/android.widget.TextView'
                amountText = driver.find_element_by_xpath(amountTextPath).text
                if stockNum in amountText:
                    amountFlag = False
                    amountCheckIndex = str(i + 1)
                    break

        if amountFlag:
            driver.swipe(200, 1760, 200, 1610, 300)
            sleep(1)
    amountCheckPath = '/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup[2]/android.view.ViewGroup[2]/android.view.ViewGroup[2]/android.view.ViewGroup/android.widget.ScrollView/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup[' + amountCheckIndex + ']/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup'
    print(amountCheckPath)
    driver.find_element_by_xpath(amountCheckPath).click()
    sleep(1)
    agreePath = '/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup[2]/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup[1]/android.view.ViewGroup/android.view.ViewGroup[1]'
    driver.find_element_by_xpath(agreePath).click()
    sleep(1)
    confirmPath = '/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup[2]/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup[2]/android.widget.TextView'
    driver.find_element_by_xpath(confirmPath).click()
    sleep(1)
    submitUi = 'new UiSelector().textContains("确认认购")'
    driver.find_element_by_android_uiautomator(submitUi).click()
    sleep(1)
    pwd = getPwd('dongCai')['tradePwd']
    print(pwd)
    getKeyCode(driver, pwd)
    sleep(1)
    endUi = 'new UiSelector().text("确认")'
    if isExist(driver, 1, endUi):
        driver.find_element_by_android_uiautomator(endUi).click()
    sleep(3)
    driver.quit()
Exemple #20
0
def buyYaoCai(param):
    code = param['code']
    isCash = param['isCash']
    stockNumVal = param['numVal']
    isFinancingAll = param['isFinancingAll']
    isCashAll = param['isCashAll']
    settingIndex = param['setIndex']
    settingData = getSetting(settingIndex)
    settingData['appPackage'] = 'com.brightsmart.android.etnet'
    settingData['appActivity'] = 'com.etnet.android.iq.Welcome'
    desired_caps = settingData
    # desired_caps = {
    #     'platformName':'Android',
    #     'platformVersion':'10',
    #     'deviceName':'2214c691',
    #     'appPackage':'com.brightsmart.android.etnet',
    #     'noReset':True,
    #     'appActivity':'com.etnet.android.iq.Welcome',
    # }
    driver = webdriver.Remote('http://*****:*****@text, "马上登录")]').click()
    # sleep(1)
    # driver.find_element_by_android_uiautomator('new UiSelector().text("新股中心")').click()
    # sleep(1)
    # driver.find_element_by_id('com.lphtsccft.zlqqt2:id/main_account').click()
    # sleep(1)
    # path = '/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.view.View/android.view.View/android.view.View/android.widget.ImageView[2]'
    # driver.find_element_by_xpath(path).click()
    # sleep(1)
    # driver.find_element_by_android_uiautomator('new UiSelector().text("打新股")').click()

    # driver.find_element_by_android_uiautomator('new UiSelector().text("新股认购")').click()
    # sleep(1)
    # driver.find_element_by_xpath('//android.widget.TextView[contains(@text, "认购中")]').click()
    # sleep(1)
    # if isExist(driver,'com.tigerbrokers.stock:id/btn_cancel') :
    #     driver.find_element_by_id('com.tigerbrokers.stock:id/btn_cancel').click()
    #     sleep(1)
    # driver.find_element_by_android_uiautomator('new UiSelector().text("IPO")').click()
    # sleep(1)
    # driver.find_element_by_android_uiautomator('new UiSelector().text("港股")').click()
    # sleep(1)

    # buyPath='//android.widget.TextView[contains(@text,"(' + code + '.HK)")]/parent::*/following-sibling::android.widget.LinearLayout[1]/android.widget.RelativeLayout/android.widget.TextView'
    # driver.find_element_by_xpath(buyPath).click()
    # sleep(1)
    # if not isCash:
    #     driver.find_element_by_id('com.juniorchina.jcstock:id/iv_margin').click()

    # numPath = 'new UiSelector().textContains("%d")'%(stockNum)
    # driver.find_element_by_android_uiautomator(numPath).click()
    # sleep(1)
    driver.quit()