Example #1
0
def Ask_Collection(driver):
    login.login_fps(login.username, login.password)
    time.sleep(10)
    print('成功')
    # 点击动态
    driver.find_element_by_xpath(
        '/html/body/div[1]/div[3]/div/ul/li[2]/a/span').click()
    time.sleep(10)
    # 点击我的问答
    driver.find_element_by_xpath(
        '/html/body/div[3]/div[4]/div/div/div[2]/ul/li[1]/a/span[1]').click()
    time.sleep(3)
    # 点击我的收藏
    driver.find_element_by_xpath(
        '//*[@id="WD"]/div/div/div[1]/ul/li[3]/a/span')
    if driver.find_element_by_link_text(u'积极健康'):
        content = '积极健康'

    actual = select(
        'SELECT mz_forum_entity.title from mz_forum_entity , mz_forum_discuss where mz_forum_entity.id=mz_forum_discuss.relate_id and mz_forum_entity.`user`=2218 ORDER BY mz_forum_entity.date_publish DESC limit 0,1 ;'
    )
    actual = filter_html_tag(str(actual[0][0]))
    update_output('FPS_003', content, actual)

    time.sleep(3)
Example #2
0
def Add_friend(driver):
    username = '******'
    password = '******'
    login.login_fps(username, password)
    time.sleep(3)
    driver.find_element_by_xpath(
        '/html/body/div[1]/div[2]/div/div/div/div/div[3]/div/ul/li[2]/a/span[1]'
    ).click()
    time.sleep(3)
    trupleFansCount0 = select(
        'select count(*) from fps_20151217.mz_common_usernetwork where userA in (select userB from fps_20151217.mz_common_usernetwork where userA=2218 ) AND userB=2218;'
    )

    # 点击下拉按钮
    driver.find_element_by_xpath('//*[@id="jiaguanzhu"]').click()
    print(trupleFansCount0[0][0])

    time.sleep(3)
    trupleFansCount1 = select(
        'select count(*)from fps_20151217.mz_common_usernetwork where userA in (select userB from fps_20151217.mz_common_usernetwork where userA=2218 ) AND userB=2218'
    )
    print(trupleFansCount1[0][0])
    intActual = trupleFansCount1[0][0] - 1
    print(intActual)
    time.sleep(5)

    update_output('FPS_014', trupleFansCount0[0][0], intActual)
Example #3
0
def My_ask(driver, content):

    login.login_fps(login.username, login.password)
    time.sleep(10)
    print('成功')
    # 点击动态
    driver.find_element_by_xpath(
        '/html/body/div[1]/div[3]/div/ul/li[2]/a/span').click()
    time.sleep(10)
    # 点击我的问答
    driver.find_element_by_xpath(
        '/html/body/div[3]/div[4]/div/div/div[2]/ul/li[1]/a/span[1]').click()
    time.sleep(3)
    driver.find_element_by_xpath(
        '//*[@id="MY_QA"]/div[1]/div[1]/div[2]/div/h3/a').click()
    time.sleep(3)

    driver.find_elements_by_link_text(u'问答详情')
    a = driver.find_elements_by_link_text(u'问答详情')

    if a == driver.find_elements_by_link_text(u'问答详情'):
        actual = '进入问答详情页'
        print('find')
        update_output('FPS_005', '进入问答详情页', actual)

    time.sleep(3)
    driver.switch_to_window(driver.window_handles[1])
    # driver.refresh()
    # 滑动滚动条到评论窗口
    # js="document.body.scrollTop=2000;"
    # driver.execute_script(js)
    time.sleep(6)
    driver.switch_to_frame("ueditor_0")
    driver.find_element_by_xpath("/html/body").send_keys(content)

    time.sleep(3)
    driver.switch_to.default_content()
    time.sleep(3)
    driver.find_element_by_xpath('//*[@id="main-reply"]').click()
    time.sleep(3)
    actual = select(
        'select content from mz_forum_discuss  where user=2218 order BY date_publish  DESC limit 0,1 ;'
    )
    time.sleep(3)
    actual = filter_html_tag(str(actual[0][0]))
    print(actual[0][0])

    update_output('FPS_006', content, actual)
Example #4
0
def Search_fans(driver):
    username = '******'
    password = '******'
    login.login_fps(username, password)
    time.sleep(3)
    driver.find_element_by_xpath(
        '/html/body/div[1]/div[2]/div/div/div/div/div[3]/div/ul/li[1]/a/span[1]'
    ).click()
    time.sleep(2)
    # 搜索好友
    driver.find_element_by_xpath('//*[@id="search-text"]/input').send_keys('S')
    time.sleep(3)
    driver.find_element_by_id('search-submit').click()
    time.sleep(3)
    if driver.find_elements_by_link_text('Sundy'):
        print('搜索成功')
        actual = 'Sundy'

    update_output('FPS_011', 'Sundy', actual)
Example #5
0
def setting(driver):
    username = '******'
    password = '******'
    login.login_fps(username, password)
    time.sleep(5)
    driver.find_element_by_link_text('个人设置').click()
    time.sleep(5)
    driver.find_element_by_xpath(
        '//*[@id="user_info_save"]/div[1]/div/span[3]/a').click()
    driver.find_element_by_id("file_upload").send_keys("E:\\Pictures\\lyp.jpg")
    time.sleep(5)
    driver.find_element_by_xpath(
        '//*[@id="upload-pane"]/div[2]/button').click()
    time.sleep(3)
    driver.find_element_by_id('id_nick_name').clear()
    time.sleep(3)
    driver.find_element_by_id('id_nick_name').send_keys(u'漆来平猪')
    driver.find_element_by_id('id_position').clear()
    time.sleep(3)
    driver.find_element_by_id('id_position').send_keys(u'测试工程师猪')
    time.sleep(2)
    driver.find_element_by_id('id_description').clear()
    driver.find_element_by_id('id_description').send_keys(u'打酱油工程师')
    js = "document.body.scrollTop=10000;"
    driver.execute_script(js)

    time.sleep(2)
    driver.find_element_by_id('id_qq').clear()
    driver.find_element_by_id('id_qq').send_keys('123456')
    time.sleep(2)

    driver.find_element_by_id('user_save').click()
    time.sleep(2)

    actual = select(
        'select nickname from mz_forum_entity where user=2218 order BY date_publish  DESC limit 0,1 ;'
    )
    print(actual)

    update_output('FPS_010', '漆来平猪', actual)
Example #6
0
def My_article(driver, content):
    login.login_fps(username, password)
    time.sleep(8)
    # 点击动态
    driver.find_element_by_xpath(
        '/html/body/div[1]/div[3]/div/ul/li[2]/a/span').click()
    time.sleep(10)
    # 点击我的文章
    driver.find_element_by_xpath(
        '/html/body/div[3]/div[4]/div/div/div[2]/ul/li[2]/a/span[1]').click()
    print('成功')
    time.sleep(3)
    driver.find_element_by_xpath(
        '//*[@id="MY_ARTICLE"]/div[1]/div[1]/div[2]/div/h3/a').click()
    driver.find_elements_by_link_text(u'文章详情')
    a = driver.find_elements_by_link_text(u'文章详情')

    if a == driver.find_elements_by_link_text(u'文章详情'):
        actual = '进入文章详情页'
        print('find')
        update_output('FPS_004', '进入文章详情页', actual)
    # 评论问答
    time.sleep(10)
    driver.refresh()
    driver.switch_to_window(driver.window_handles[1])
    driver.switch_to_frame("ueditor_0")
    driver.find_element_by_xpath("/html/body").send_keys(content)
    time.sleep(3)
    driver.switch_to.default_content()
    print('pass')
    time.sleep(3)
    driver.find_element_by_xpath('//*[@id="main-reply"]').click()
    print('评论成功')
    actual = select(
        'select content from mz_forum_discuss  where user=2218 order BY date_publish  DESC limit 0,1 ;'
    )
    actual = filter_html_tag(str(actual[0][0]))
    print(actual[0][0])
    update_output('FPS_010', content, actual)
Example #7
0
def Article_Collection(driver):
    login.login_fps(username, password)
    time.sleep(8)
    # 点击动态
    driver.find_element_by_xpath(
        '/html/body/div[1]/div[3]/div/ul/li[2]/a/span').click()
    time.sleep(10)
    # 点击我的文章
    driver.find_element_by_xpath(
        '/html/body/div[3]/div[4]/div/div/div[2]/ul/li[2]/a/span[1]').click()
    time.sleep(8)
    print('成功')
    # 点击我的收藏
    driver.find_element_by_xpath('//*[@id="WZ"]/div/div/div[1]/ul/li[2]/a[2]')
    if driver.find_element_by_link_text(u'要不要来讨论一下评论和文章该换哪种富文本编辑器呢'):
        content = '要不要来讨论一下评论和文章该换哪种富文本编辑器呢'

    actual = select(
        'SELECT mz_forum_entity.title from mz_forum_entity , mz_forum_article where mz_forum_entity.id=mz_forum_article.entity_ptr_id and mz_forum_entity.user=2218 ORDER BY mz_forum_entity.date_publish DESC limit 0,1 ;'
    )
    actual = filter_html_tag(str(actual[0][0]))
    update_output('FPS_007', content, actual)
Example #8
0
def Cancel_friend(driver):
    username = '******'
    password = '******'
    login.login_fps(username, password)
    time.sleep(3)
    driver.find_element_by_xpath(
        '/html/body/div[1]/div[2]/div/div/div/div/div[3]/div/ul/li[1]/a/span[1]'
    ).click()
    time.sleep(3)
    trupleFansCount0 = select(
        'select count(*) from fps_20151217.mz_common_usernetwork where userA in (select userB from fps_20151217.mz_common_usernetwork where userA=2218 ) AND userB=2218;'
    )
    print(trupleFansCount0[0][0])
    # 点击我的好友
    driver.find_element_by_xpath(
        '/html/body/div[1]/div[4]/div/div/div[1]/div/div/div/div[1]/ul/li[1]/a[2]'
    ).click()
    time.sleep(3)
    # 点击下拉按钮
    driver.find_element_by_xpath(
        '//*[@id="MY_FRIEND"]/div/div[1]/div/div/div[2]/div[1]/div[2]/div/a/span'
    ).click()
    time.sleep(3)
    driver.find_element_by_xpath(
        '//*[@id="MY_FRIEND"]/div/div[1]/div/div/div[2]/div[1]/div[2]/div/ul/li/a'
    ).click()
    time.sleep(3)
    # 查询数据库
    trupleFansCount1 = select(
        'select count(*)from fps_20151217.mz_common_usernetwork where userA in (select userB from fps_20151217.mz_common_usernetwork where userA=2218 ) AND userB=2218'
    )
    print(trupleFansCount1)
    intActual = trupleFansCount1[0][0] + 1
    time.sleep(5)

    update_output('FPS_015', trupleFansCount0[0][0], intActual)
    print(intActual)
Example #9
0
def enter_publish_article(driver):
    login.login_fps(username, password)
    time.sleep(8)
    # 点击动态
    driver.find_element_by_xpath(
        '/html/body/div[1]/div[3]/div/ul/li[2]/a/span').click()
    time.sleep(10)
    # 点击我的文章
    driver.find_element_by_xpath(
        '/html/body/div[3]/div[4]/div/div/div[2]/ul/li[2]/a/span[1]').click()
    print('成功')
    time.sleep(3)
    driver.find_element_by_xpath('//*[@id="WZ"]/div/div/div[1]/a').click()
    time.sleep(5)
    print('test')
    if driver.find_element_by_xpath(
            '/html/body/div[1]/div[3]/div/div/div[2]/div/div/div[1]/span'):

        actual = '进入发布文章页面'

    print(actual)

    update_output('FPS_009', '进入发布文章页面', actual)
    time.sleep(3)
Example #10
0
def enter_publish_ask(driver):

    login.login_fps(login.username, login.password)
    time.sleep(10)
    print('成功')
    # 点击动态
    driver.find_element_by_xpath(
        '/html/body/div[1]/div[3]/div/ul/li[2]/a/span').click()
    time.sleep(10)
    # 点击我的问答
    driver.find_element_by_xpath(
        '/html/body/div[3]/div[4]/div/div/div[2]/ul/li[1]/a/span[1]').click()
    time.sleep(3)
    driver.find_element_by_xpath('//*[@id="WD"]/div/div/div[1]/a').click()
    time.sleep(5)
    print('test')
    if driver.find_element_by_xpath(
            '/html/body/div[1]/div[3]/div/div/div[2]/div/div/div[1]/span'):

        actual = '进入发布问答页面'

    print(actual)

    update_output('FPS_004', '进入发布问答页面', actual)