Esempio n. 1
0
def my_message(driver):
    #点击我的趣聊
    driver.find_elements_by_xpath(
        '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[1]/*'
    )[6].click()
    #随机点击一个人
    random_click(
        driver,
        '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/')[1].click()
    #点击输入框
    driver.find_element_by_xpath(
        '//UIAApplication[1]/UIAWindow[1]/UIATextView[1]').click()
    #输入要发送内容
    driver.find_element_by_xpath(
        '//UIAApplication[1]/UIAWindow[1]/UIATextView[1]').send_keys(u'你好')
    driver.find_elements_by_xpath(
        '//UIAApplication[1]/UIAWindow[2]/*/UIAButton')[-3].click()
    #返回上一级
    driver.find_element_by_xpath(
        '//UIAApplication[1]/UIAWindow[1]/UIANavigationBar[1]/UIAButton[2]'
    ).click()
    #返回我的个人主页
    driver.find_element_by_xpath(
        '//UIAApplication[1]/UIAWindow[1]/UIANavigationBar[1]/UIAButton[2]'
    ).click()
Esempio n. 2
0
def message(driver):
    '''
    到我的关注页面随机给一个人发送一个私信
    '''
    #点击到我的关注页面
    driver.find_element_by_xpath(
        '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[1]/UIAButton[1]'
    ).click()
    #随机点击一个人
    random_click(
        driver,
        '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/')[1].click()
    #点击发送私信
    driver.find_element_by_xpath(
        '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[1]/UIAButton[2]'
    ).click()
    #点击输入框
    driver.find_element_by_xpath(
        '//UIAApplication[1]/UIAWindow[1]/UIATextView[1]').click()
    #输入要发送内容
    driver.find_element_by_xpath(
        '//UIAApplication[1]/UIAWindow[1]/UIATextView[1]').send_keys(u'你好')
    driver.find_elements_by_xpath(
        '//UIAApplication[1]/UIAWindow[2]/*/UIAButton')[-3].click()
    #确认最后一条消息是谁发的
    #print driver.find_elements_by_xpath(
    #    '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[*]/*')[-1].location['x']
    #返回上一级
    driver.find_element_by_xpath(
        '//UIAApplication[1]/UIAWindow[1]/UIANavigationBar[1]/UIAButton[2]'
    ).click()
    for i in range(2):
        driver.find_element_by_name(u'返回').click()
Esempio n. 3
0
def my_look(driver):
    '''
    我的关注页面随机选择一个人查看他的个人资料
    '''
    #点击进入我的关注页面
    driver.find_element_by_xpath(
        '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[1]/UIAButton[1]').click()

    log_info(
        'have ' + str(len(driver.find_elements_by_xpath('//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/*'))) + 's ')
    #随机选择一个人
    random_click(driver, '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/')[1].click()
    #获取个人资料
    person = {'name': driver.find_element_by_xpath(
        '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableGroup[1]/UIAStaticText[1]').text,
              'follower': driver.find_element_by_xpath(
                  '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableGroup[1]/UIAStaticText[3]').text[:-3],
              'gender': driver.find_element_by_xpath(
                  '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[4]/UIAStaticText[1]').text[3:],
              'addr': driver.find_element_by_xpath(
                  '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[4]/UIAStaticText[2]').text[3:],
              'birthday': driver.find_element_by_xpath(
                  '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[4]/UIAStaticText[3]').text[3:]
    }
    log_info("His/her profile: name " + person['name'] + ", follower " + person['follower'] + ", gender " + person[
        'gender'] + ", addr " + person['addr'] + ", birthday " + person['birthday'])
    #返回到我的个人资料主页
    for i in range(2):
        driver.find_element_by_name(u'返回').click()
Esempio n. 4
0
def my_fans(driver):
    '''
    我的粉丝页面随机选择一个人发送私信
    '''
    #点击我的粉丝
    driver.find_elements_by_xpath(
        '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[1]/*'
    )[3].click()
    #随机选择一个人
    random_click(
        driver,
        '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/')[1].click()
    #获取个人资料
    person = {
        'name':
        driver.find_element_by_xpath(
            '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableGroup[1]/UIAStaticText[1]'
        ).text,
        'follower':
        driver.find_element_by_xpath(
            '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableGroup[1]/UIAStaticText[3]'
        ).text[:-3],
        'gender':
        driver.find_element_by_xpath(
            '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[4]/UIAStaticText[1]'
        ).text[3:],
        'addr':
        driver.find_element_by_xpath(
            '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[4]/UIAStaticText[2]'
        ).text[3:],
        'birthday':
        driver.find_element_by_xpath(
            '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[4]/UIAStaticText[3]'
        ).text[3:]
    }
    log_info("His/her profile: name " + person['name'] + ", follower " +
             person['follower'] + ", gender " + person['gender'] + ", addr " +
             person['addr'] + ", birthday " + person['birthday'])
    #点击发送私信
    driver.find_element_by_xpath(
        '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[1]/UIAButton[2]'
    ).click()
    #点击输入框
    driver.find_element_by_xpath(
        '//UIAApplication[1]/UIAWindow[1]/UIATextView[1]').click()
    #输入要发送内容
    driver.find_element_by_xpath(
        '//UIAApplication[1]/UIAWindow[1]/UIATextView[1]').send_keys(u'你好')
    driver.find_elements_by_xpath(
        '//UIAApplication[1]/UIAWindow[2]/*/UIAButton')[-3].click()
    #print driver.find_elements_by_xpath(
    #    '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[*]/*')[-1].location['x']
    #返回上一级
    driver.find_element_by_xpath(
        '//UIAApplication[1]/UIAWindow[1]/UIANavigationBar[1]/UIAButton[2]'
    ).click()
    #返回到我的个人页面
    for i in range(2):
        driver.find_element_by_name(u'返回').click()
Esempio n. 5
0
def my_collect(driver):
    #点击我的收藏
    driver.find_elements_by_xpath(
        '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[1]/*')[7].click()
    #随机选择一个八卦
    random_click(driver, '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/')[0].click()
    #发送道具
    send_daoju(driver)
    #返回到我的主页
    double_return(driver)
Esempio n. 6
0
def my_gossip(driver):
    '''
    我的八卦页面,随机查看一个八卦
    '''
    #我的八卦页面
    driver.find_elements_by_xpath(
        '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[1]/*')[1].click()
    #随机选择一个八卦
    random_click(driver, '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/')[0].click()
    #发送道具
    send_daoju(driver)
Esempio n. 7
0
def my_collect(driver):
    #点击我的收藏
    driver.find_elements_by_xpath(
        '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[1]/*'
    )[7].click()
    #随机选择一个八卦
    random_click(
        driver,
        '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/')[0].click()
    #发送道具
    send_daoju(driver)
    #返回到我的主页
    double_return(driver)
Esempio n. 8
0
def my_gossip(driver):
    '''
    我的八卦页面,随机查看一个八卦
    '''
    #我的八卦页面
    driver.find_elements_by_xpath(
        '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[1]/*'
    )[1].click()
    #随机选择一个八卦
    random_click(
        driver,
        '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/')[0].click()
    #发送道具
    send_daoju(driver)
Esempio n. 9
0
def my_message(driver):
    #点击我的趣聊
    driver.find_elements_by_xpath(
        '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[1]/*')[6].click()
    #随机点击一个人
    random_click(driver, '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/')[1].click()
    #点击输入框
    driver.find_element_by_xpath('//UIAApplication[1]/UIAWindow[1]/UIATextView[1]').click()
    #输入要发送内容
    driver.find_element_by_xpath('//UIAApplication[1]/UIAWindow[1]/UIATextView[1]').send_keys(u'你好')
    driver.find_elements_by_xpath('//UIAApplication[1]/UIAWindow[2]/*/UIAButton')[-3].click()
    #返回上一级
    driver.find_element_by_xpath('//UIAApplication[1]/UIAWindow[1]/UIANavigationBar[1]/UIAButton[2]').click()
    #返回我的个人主页
    driver.find_element_by_xpath('//UIAApplication[1]/UIAWindow[1]/UIANavigationBar[1]/UIAButton[2]').click()
Esempio n. 10
0
def my_guess(driver):
    '''
    我的竞猜获取竞猜内容
    '''
    #点击我的竞猜按钮
    driver.find_elements_by_xpath(
        '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[1]/*'
    )[4].click()
    while True:
        try:
            #随机点击一个我参与的竞猜
            random_click(driver,
                         '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/'
                         )[0].click()
            #向上滑动
            slide_up(driver)
            #选择竞猜一个
            #driver.find_element_by_xpath(
            #    '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[' + str(len(driver.find_elements_by_xpath(
            #        '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[*]'))) + ']/UIATextField[1]').click()
            driver.find_element_by_xpath(
                '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell['
                + str(
                    len(
                        driver.find_elements_by_xpath(
                            '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[*]'
                        ))) + ']/UIATextField[1]').send_keys('3')
            #向上滑动取消竞猜
            driver.swipe(100, 145, 100, 120)
            #点击竞猜
            driver.find_element_by_xpath(
                '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIAButton[1]'
            ).click()
            #点击确认购买
            driver.find_element_by_name(u'购买').click()
            break
        except:
            driver.find_element_by_xpath(u'返回').click()
            continue
            #等待购买成功
    time.sleep(3)
    share(driver, to=random.choice([u'朋友圈', u'微信', u'微博']))
    driver.find_element_by_name(u'返回').click()
    #返回上一级
    driver.find_element_by_xpath(
        '//UIAApplication[1]/UIAWindow[1]/UIANavigationBar[1]/UIAButton[1]'
    ).click()
Esempio n. 11
0
def my_look(driver):
    '''
    我的关注页面随机选择一个人查看他的个人资料
    '''
    #点击进入我的关注页面
    driver.find_element_by_xpath(
        '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[1]/UIAButton[1]'
    ).click()

    log_info('have ' + str(
        len(
            driver.find_elements_by_xpath(
                '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/*'))) + 's ')
    #随机选择一个人
    random_click(
        driver,
        '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/')[1].click()
    #获取个人资料
    person = {
        'name':
        driver.find_element_by_xpath(
            '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableGroup[1]/UIAStaticText[1]'
        ).text,
        'follower':
        driver.find_element_by_xpath(
            '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableGroup[1]/UIAStaticText[3]'
        ).text[:-3],
        'gender':
        driver.find_element_by_xpath(
            '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[4]/UIAStaticText[1]'
        ).text[3:],
        'addr':
        driver.find_element_by_xpath(
            '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[4]/UIAStaticText[2]'
        ).text[3:],
        'birthday':
        driver.find_element_by_xpath(
            '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[4]/UIAStaticText[3]'
        ).text[3:]
    }
    log_info("His/her profile: name " + person['name'] + ", follower " +
             person['follower'] + ", gender " + person['gender'] + ", addr " +
             person['addr'] + ", birthday " + person['birthday'])
    #返回到我的个人资料主页
    for i in range(2):
        driver.find_element_by_name(u'返回').click()
Esempio n. 12
0
def my_guess(driver):
    '''
    我的竞猜获取竞猜内容
    '''
    #点击我的竞猜按钮
    driver.find_elements_by_xpath(
        '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[1]/*')[4].click()
    while True:
        try:
            #随机点击一个我参与的竞猜
            random_click(driver, '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/')[0].click()
            #向上滑动
            slide_up(driver)
            #选择竞猜一个
            #driver.find_element_by_xpath(
            #    '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[' + str(len(driver.find_elements_by_xpath(
            #        '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[*]'))) + ']/UIATextField[1]').click()
            driver.find_element_by_xpath(
                '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[' + str(
                    len(driver.find_elements_by_xpath(
                        '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[*]'))) + ']/UIATextField[1]').send_keys(
                '3')
            #向上滑动取消竞猜
            driver.swipe(100, 145, 100, 120)
            #点击竞猜
            driver.find_element_by_xpath('//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIAButton[1]').click()
            #点击确认购买
            driver.find_element_by_name(u'购买').click()
            break
        except:
            driver.find_element_by_xpath(u'返回').click()
            continue
            #等待购买成功
    time.sleep(3)
    share(driver, to=random.choice([u'朋友圈', u'微信', u'微博']))
    driver.find_element_by_name(u'返回').click()
    #返回上一级
    driver.find_element_by_xpath('//UIAApplication[1]/UIAWindow[1]/UIANavigationBar[1]/UIAButton[1]').click()
Esempio n. 13
0
def my_fans(driver):
    '''
    我的粉丝页面随机选择一个人发送私信
    '''
    #点击我的粉丝
    driver.find_elements_by_xpath(
        '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[1]/*')[3].click()
    #随机选择一个人
    random_click(driver, '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/')[1].click()
    #获取个人资料
    person = {'name': driver.find_element_by_xpath(
        '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableGroup[1]/UIAStaticText[1]').text,
              'follower': driver.find_element_by_xpath(
                  '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableGroup[1]/UIAStaticText[3]').text[:-3],
              'gender': driver.find_element_by_xpath(
                  '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[4]/UIAStaticText[1]').text[3:],
              'addr': driver.find_element_by_xpath(
                  '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[4]/UIAStaticText[2]').text[3:],
              'birthday': driver.find_element_by_xpath(
                  '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[4]/UIAStaticText[3]').text[3:]
    }
    log_info("His/her profile: name " + person['name'] + ", follower " + person['follower'] + ", gender " + person[
        'gender'] + ", addr " + person['addr'] + ", birthday " + person['birthday'])
    #点击发送私信
    driver.find_element_by_xpath(
        '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[1]/UIAButton[2]').click()
    #点击输入框
    driver.find_element_by_xpath('//UIAApplication[1]/UIAWindow[1]/UIATextView[1]').click()
    #输入要发送内容
    driver.find_element_by_xpath('//UIAApplication[1]/UIAWindow[1]/UIATextView[1]').send_keys(u'你好')
    driver.find_elements_by_xpath('//UIAApplication[1]/UIAWindow[2]/*/UIAButton')[-3].click()
    #print driver.find_elements_by_xpath(
    #    '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[*]/*')[-1].location['x']
    #返回上一级
    driver.find_element_by_xpath('//UIAApplication[1]/UIAWindow[1]/UIANavigationBar[1]/UIAButton[2]').click()
    #返回到我的个人页面
    for i in range(2):
        driver.find_element_by_name(u'返回').click()
Esempio n. 14
0
def message(driver):
    '''
    到我的关注页面随机给一个人发送一个私信
    '''
    #点击到我的关注页面
    driver.find_element_by_xpath(
        '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[1]/UIAButton[1]').click()
    #随机点击一个人
    random_click(driver, '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/')[1].click()
    #点击发送私信
    driver.find_element_by_xpath(
        '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[1]/UIAButton[2]').click()
    #点击输入框
    driver.find_element_by_xpath('//UIAApplication[1]/UIAWindow[1]/UIATextView[1]').click()
    #输入要发送内容
    driver.find_element_by_xpath('//UIAApplication[1]/UIAWindow[1]/UIATextView[1]').send_keys(u'你好')
    driver.find_elements_by_xpath('//UIAApplication[1]/UIAWindow[2]/*/UIAButton')[-3].click()
    #确认最后一条消息是谁发的
    #print driver.find_elements_by_xpath(
    #    '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[*]/*')[-1].location['x']
    #返回上一级
    driver.find_element_by_xpath('//UIAApplication[1]/UIAWindow[1]/UIANavigationBar[1]/UIAButton[2]').click()
    for i in range(2):
        driver.find_element_by_name(u'返回').click()
Esempio n. 15
0
def participation_guess(driver, by):
    '''
    随机选择一个竞猜然后点击进入到竞猜详情页面
    by  购买、合买、跟单
    运行完之后返回到竞猜列表页面
    '''
    #随机选中一个
    random_click(
        driver,
        '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/')[0].click()
    #等待竞猜页面加载出来
    WebDriverWait(driver, 20).until(lambda x: x.find_element_by_xpath(
        '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableGroup[2]/UIAStaticText[1]'
    ))
    if by == u'购买':
        #随机选择一个
        driver.find_element_by_xpath(
            '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[4]/UIATextField[1]'
        ).click()
        driver.find_element_by_xpath(
            '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[4]/UIATextField[1]'
        ).send_keys('3')
        #上划一下
        driver.swipe(100, 145, 100, 120)
        #点击竞猜
        driver.find_element_by_xpath(
            '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIAButton[1]'
        ).click()

    elif by == u'合买':
        #点击合买按钮
        driver.find_element_by_xpath(
            '//UIAApplication[1]/UIAWindow[1]/UIAButton[1]').click()
        #填写发起的份数
        driver.find_element_by_xpath(
            '//UIAApplication[1]/UIAWindow[1]/UIATextField[1]').click()
        driver.find_element_by_xpath(
            '//UIAApplication[1]/UIAWindow[1]/UIATextField[1]').send_keys(
                '300')
        #填写认购的份数
        driver.find_element_by_xpath(
            '//UIAApplication[1]/UIAWindow[1]/UIATextField[2]').click()
        driver.find_element_by_xpath(
            '//UIAApplication[1]/UIAWindow[1]/UIATextField[2]').send_keys('32')
        #上划一下
        driver.swipe(177, 404, 177, 350)
        #点击支付
        driver.find_element_by_name(u'支   付').click()

    elif by == u'跟单':
        #点击跟单
        driver.find_element_by_xpath(
            '//UIAApplication[1]/UIAWindow[1]/UIAButton[4]').click()
        if driver.find_elements_by_xpath(
                '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/*'):
            for i in range(
                    1,
                    len(
                        driver.find_element_by_xpath(
                            '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/*'
                        )) + 1):
                #随机跟单一个
                driver.find_element_by_xpath(
                    '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell['
                    + str(i) + ']/UIATextField[1]').click()
                driver.find_element_by_xpath(
                    '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell['
                    + str(i) + ']/UIATextField[1]').send_keys('3')
        else:
            #返回到竞猜列表页面
            driver.find_element_by_xpath(
                '//UIAApplication[1]/UIAWindow[1]/UIANavigationBar[1]/UIAButton[1]'
            ).click()
            participation_guess(driver, by)
            #上划一下
        driver.swipe(100, 145, 100, 120)
        #点击支付
        driver.find_element_by_name(u'支   付').click()
        #点击确认购买
    driver.find_element_by_name(u'购买').click()
    #等待购买成功
    driver.find_element_by_name(u'返回').click()

    #返回到竞猜列表页面
    driver.find_element_by_xpath(
        '//UIAApplication[1]/UIAWindow[1]/UIANavigationBar[1]/UIAButton[1]'
    ).click()
Esempio n. 16
0
def participation_guess(driver, by):
    '''
    随机选择一个竞猜然后点击进入到竞猜详情页面
    by  购买、合买、跟单
    运行完之后返回到竞猜列表页面
    '''
    #随机选中一个
    random_click(driver, '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/')[0].click()
    #等待竞猜页面加载出来
    WebDriverWait(driver, 20).until(lambda x: x.find_element_by_xpath(
        '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableGroup[2]/UIAStaticText[1]'))
    if by == u'购买':
        #随机选择一个
        driver.find_element_by_xpath(
            '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[4]/UIATextField[1]').click()
        driver.find_element_by_xpath(
            '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[4]/UIATextField[1]').send_keys('3')
        #上划一下
        driver.swipe(100, 145, 100, 120)
        #点击竞猜
        driver.find_element_by_xpath('//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIAButton[1]').click()

    elif by == u'合买':
        #点击合买按钮
        driver.find_element_by_xpath('//UIAApplication[1]/UIAWindow[1]/UIAButton[1]').click()
        #填写发起的份数
        driver.find_element_by_xpath('//UIAApplication[1]/UIAWindow[1]/UIATextField[1]').click()
        driver.find_element_by_xpath('//UIAApplication[1]/UIAWindow[1]/UIATextField[1]').send_keys('300')
        #填写认购的份数
        driver.find_element_by_xpath('//UIAApplication[1]/UIAWindow[1]/UIATextField[2]').click()
        driver.find_element_by_xpath('//UIAApplication[1]/UIAWindow[1]/UIATextField[2]').send_keys('32')
        #上划一下
        driver.swipe(177, 404, 177, 350)
        #点击支付
        driver.find_element_by_name(u'支   付').click()

    elif by == u'跟单':
        #点击跟单
        driver.find_element_by_xpath('//UIAApplication[1]/UIAWindow[1]/UIAButton[4]').click()
        if driver.find_elements_by_xpath('//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/*'):
            for i in range(1,
                           len(driver.find_element_by_xpath('//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/*')) + 1):
            #随机跟单一个
                driver.find_element_by_xpath(
                    '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[' + str(
                        i) + ']/UIATextField[1]').click()
                driver.find_element_by_xpath(
                    '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[' + str(
                        i) + ']/UIATextField[1]').send_keys('3')
        else:
            #返回到竞猜列表页面
            driver.find_element_by_xpath('//UIAApplication[1]/UIAWindow[1]/UIANavigationBar[1]/UIAButton[1]').click()
            participation_guess(driver, by)
            #上划一下
        driver.swipe(100, 145, 100, 120)
        #点击支付
        driver.find_element_by_name(u'支   付').click()
        #点击确认购买
    driver.find_element_by_name(u'购买').click()
    #等待购买成功
    driver.find_element_by_name(u'返回').click()

    #返回到竞猜列表页面
    driver.find_element_by_xpath('//UIAApplication[1]/UIAWindow[1]/UIANavigationBar[1]/UIAButton[1]').click()