Example #1
0
def change_mysignature(driver):
    '''
    更换签名
    '''
    #点击我的签名
    driver.find_element_by_xpath(
        '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableGroup[1]/UIAStaticText[2]'
    ).click()
    #清除签名
    driver.find_element_by_xpath(
        '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[1]/UIATextView[1]'
    ).clear()
    #输入签名内容
    driver.find_element_by_xpath(
        '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[1]/UIATextView[1]'
    ).send_keys(randomCN(20))
    #点击保存
    driver.find_element_by_name(u'保存').click()
Example #2
0
def my_profile(driver):
    #点击我的资料进入到我的资料修改页面
    driver.find_elements_by_xpath(
        '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[1]/*'
    )[5].click()
    #查看是否有历史头像
    if driver.find_elements_by_xpath(
            '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[2]/*'
    ):
        log_info('have history picture')
    else:
        log_info('no history picture')
        #修改个人昵称
    driver.find_element_by_xpath(
        '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[3]/UIAStaticText[2]'
    ).click()
    #输入修改的个人昵称
    driver.find_element_by_xpath(
        '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[1]/UIATextField[1]'
    ).send_keys(randomCN(3))
    #保存修改
    driver.find_element_by_name(u'保存').click()
    #点击修改个性签名
    #qm = driver.find_element_by_xpath('//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[4]').location
    #qm_s = driver.find_element_by_xpath('//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[4]').size
    #driver.swipe(int(qm['x']) + (int(qm_s['width']) / 2), int(qm['y']) + (int(qm_s['height']) / 2),
    #             int(qm['x']) + (int(qm_s['width']) / 2), int(qm['y']) + (int(qm_s['height']) / 2))
    #输入个性签名
    #driver.find_element_by_xpath(
    #    '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[1]/UIATextView[1]').send_keys(randomCN(10))
    #点击保存
    #driver.find_element_by_name(u'保存').click()
    time.sleep(2)
    #随机选择性别
    random.choice(
        driver.find_elements_by_xpath(
            '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[5]/UIAButton[*]'
        )).click()
    #点击返回
    driver.find_element_by_name(u'返回').click()
Example #3
0
def change_mysignature(driver):
    '''
    更换签名
    '''
    #点击我的签名
    driver.find_element_by_xpath(
        '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableGroup[1]/UIAStaticText[2]').click()
    #清除签名
    driver.find_element_by_xpath(
        '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[1]/UIATextView[1]').clear()
    #输入签名内容
    driver.find_element_by_xpath(
        '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[1]/UIATextView[1]').send_keys(randomCN(20))
    #点击保存
    driver.find_element_by_name(u'保存').click()
Example #4
0
def my_profile(driver):
    #点击我的资料进入到我的资料修改页面
    driver.find_elements_by_xpath(
        '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[1]/*')[5].click()
    #查看是否有历史头像
    if driver.find_elements_by_xpath('//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[2]/*'):
        log_info('have history picture')
    else:
        log_info('no history picture')
        #修改个人昵称
    driver.find_element_by_xpath(
        '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[3]/UIAStaticText[2]').click()
    #输入修改的个人昵称
    driver.find_element_by_xpath(
        '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[1]/UIATextField[1]').send_keys(randomCN(3))
    #保存修改
    driver.find_element_by_name(u'保存').click()
    #点击修改个性签名
    #qm = driver.find_element_by_xpath('//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[4]').location
    #qm_s = driver.find_element_by_xpath('//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[4]').size
    #driver.swipe(int(qm['x']) + (int(qm_s['width']) / 2), int(qm['y']) + (int(qm_s['height']) / 2),
    #             int(qm['x']) + (int(qm_s['width']) / 2), int(qm['y']) + (int(qm_s['height']) / 2))
    #输入个性签名
    #driver.find_element_by_xpath(
    #    '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[1]/UIATextView[1]').send_keys(randomCN(10))
    #点击保存
    #driver.find_element_by_name(u'保存').click()
    time.sleep(2)
    #随机选择性别
    random.choice(driver.find_elements_by_xpath(
        '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[5]/UIAButton[*]')).click()
    #点击返回
    driver.find_element_by_name(u'返回').click()
Example #5
0
def create_guss(driver):
    '''
    创建竞猜

    '''
    #点击发起竞猜按钮
    driver.find_element_by_name(u'发起竞猜').click()
    #点击竞猜标题输入区
    driver.find_element_by_xpath(
        '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[1]/UIATextView[1]'
    ).click()
    driver.find_element_by_xpath(
        '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[1]/UIATextView[1]'
    ).send_keys(u'自动化测试')
    #点击并输入内容
    driver.find_element_by_xpath(
        '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[2]/UIATextView[1]'
    ).click()
    driver.find_element_by_xpath(
        '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[2]/UIATextView[1]'
    ).send_keys(randomCN(10))
    #循环添加两次答案
    for i in range(2):
        #点击添加答案
        driver.find_element_by_xpath(
            '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableGroup[6]/UIAStaticText[1]'
        ).click()
        #弹出框内输入答案
        driver.find_element_by_xpath(
            '//UIAApplication[1]/UIAWindow[3]/UIAAlert[1]/UIAScrollView[1]/UIATableView[1]/UIATableCell[1]/UIATextField[1]'
        ).click()
        driver.find_element_by_xpath(
            '//UIAApplication[1]/UIAWindow[3]/UIAAlert[1]/UIAScrollView[1]/UIATableView[1]/UIATableCell[1]/UIATextField[1]'
        ).send_keys(randomCN(3))
        #点击确定
        driver.find_element_by_name(u'确定').click()
    #选择一个答案
    driver.find_element_by_xpath(
        '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[3]/UIAButton[1]'
    ).click()
    #使用相册
    #driver.find_element_by_xpath('//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[5]/UIAButton[2]').click()
    #随机选择一个相册
    #random_click(driver, '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/*')[0].click()
    #随机选择一张照片
    #random.choice(driver.find_elements_by_xpath('//UIAApplication[1]/UIAWindow[1]/UIACollectionView[1]/*')).click()
    #选取内容
    #driver.find_element_by_name(u'选取').click()
    #拍照方式
    driver.find_element_by_xpath(
        '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[5]/UIAButton[1]'
    ).click()
    #点击取景按钮拍照
    time.sleep(1)
    driver.find_element_by_xpath(
        '//UIAApplication[1]/UIAWindow[1]/UIAButton[6]').click()
    #选择照片
    driver.find_element_by_name(u'使用照片').click()
    #向上滑动
    slide_up(driver)
    #选择预计开奖时间
    driver.find_element_by_xpath(
        '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[6]/UIAStaticText[1]'
    ).click()
    time.sleep(2)
    #点击确定
    driver.swipe(295, 333, 295, 333)
    #点击并发布
    driver.find_element_by_name('支付并发布').click()
    #等待发布成功并回到竞猜主页面
    WebDriverWait(driver, 20).until(lambda x: x.find_element_by_xpath(
        '//UIAApplication[1]/UIAWindow[1]/UIANavigationBar[1]/UIAStaticText[1]'
    ))
def create_guss(driver):
    '''
    创建竞猜

    '''
    #点击发起竞猜按钮
    driver.find_element_by_name(u'发起竞猜').click()
    #点击竞猜标题输入区
    driver.find_element_by_xpath(
        '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[1]/UIATextView[1]').click()
    driver.find_element_by_xpath(
        '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[1]/UIATextView[1]').send_keys(u'自动化测试')
    #点击并输入内容
    driver.find_element_by_xpath(
        '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[2]/UIATextView[1]').click()
    driver.find_element_by_xpath(
        '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[2]/UIATextView[1]').send_keys(randomCN(10))
    #循环添加两次答案
    for i in range(2):
        #点击添加答案
        driver.find_element_by_xpath(
            '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableGroup[6]/UIAStaticText[1]').click()
        #弹出框内输入答案
        driver.find_element_by_xpath(
            '//UIAApplication[1]/UIAWindow[3]/UIAAlert[1]/UIAScrollView[1]/UIATableView[1]/UIATableCell[1]/UIATextField[1]').click()
        driver.find_element_by_xpath(
            '//UIAApplication[1]/UIAWindow[3]/UIAAlert[1]/UIAScrollView[1]/UIATableView[1]/UIATableCell[1]/UIATextField[1]').send_keys(
            randomCN(3))
        #点击确定
        driver.find_element_by_name(u'确定').click()
    #选择一个答案
    driver.find_element_by_xpath(
        '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[3]/UIAButton[1]').click()
    #使用相册
    #driver.find_element_by_xpath('//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[5]/UIAButton[2]').click()
    #随机选择一个相册
    #random_click(driver, '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/*')[0].click()
    #随机选择一张照片
    #random.choice(driver.find_elements_by_xpath('//UIAApplication[1]/UIAWindow[1]/UIACollectionView[1]/*')).click()
    #选取内容
    #driver.find_element_by_name(u'选取').click()
    #拍照方式
    driver.find_element_by_xpath(
        '//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[5]/UIAButton[1]').click()
    #点击取景按钮拍照
    time.sleep(1)
    driver.find_element_by_xpath('//UIAApplication[1]/UIAWindow[1]/UIAButton[6]').click()
    #选择照片
    driver.find_element_by_name(u'使用照片').click()
    #向上滑动
    slide_up(driver)
    #选择预计开奖时间
    driver.find_element_by_xpath('//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[6]/UIAStaticText[1]').click()
    time.sleep(2)
    #点击确定
    driver.swipe(295, 333, 295, 333)
    #点击并发布
    driver.find_element_by_name('支付并发布').click()
    #等待发布成功并回到竞猜主页面
    WebDriverWait(driver, 20).until(
        lambda x: x.find_element_by_xpath('//UIAApplication[1]/UIAWindow[1]/UIANavigationBar[1]/UIAStaticText[1]'))