Exemplo n.º 1
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)
Exemplo n.º 2
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)
Exemplo n.º 3
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)
Exemplo n.º 4
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)
Exemplo n.º 5
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)
Exemplo n.º 6
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)