def get_weibo_url(self, weibo_driver):
     wei = WeiboPageCommon.weibo_parse(weibo_driver)
     if wei.comment_num > 0:
         WeiboPageCommon.comment_action(weibo_driver)
         comment_list = WeiboPageCommon.comment_list(weibo_driver)
         comment = WeiboPageCommon.comment_parse(comment_list[0])
         url = comment[0]
         return url
 def get_weibo_url(self, weibo_driver):
     wei = WeiboPageCommon.weibo_parse(weibo_driver)
     if wei.comment_num > 0:
         WeiboPageCommon.comment_action(weibo_driver)
         comment_list = WeiboPageCommon.comment_list(weibo_driver)
         comment = WeiboPageCommon.comment_parse(comment_list[0])
         url = comment[0]
         return url
    def focuos(self, webdriver):
        TopFrameAction.homeAction(webdriver)
        focus_box = webdriver.find_element_by_id('Pl_Core_T8CustomTriColumn__3')
        focus_box.find_element_by_link_text("关注").click()

if __name__ == '__main__':
    weibo = LoginController('13951640490', 'gongyong505.')
    weibo.login()
    time.sleep(5)
    weibo.browser.get('http://weibo.com/545352510')
    time.sleep(3)
    FriendHomePage.focus_action(weibo.browser)
    FocusPage.next_page_action(weibo.browser)
    f = FollowShipControl()
    f.fouces_friend_of_comment(weibo.browser)
    weibo_list = WeiboPageCommon.get_all_weibo(weibo.browser)
    time.sleep(3)
    for weibo_driver in weibo_list:
        wei = WeiboPageCommon.weibo_parse(weibo_driver)
        if wei.comment_num > 0:
            WeiboPageCommon.comment_action(weibo_driver)
            comment_list = WeiboPageCommon.comment_list(weibo_driver)
            comment = WeiboPageCommon.comment_parse(comment_list[0])
            url = comment[0]
            weibo.browser.get(url)
            FriendHomePage.focus_action(weibo.browser)
            break

    print ''

        TopFrameAction.homeAction(webdriver)
        focus_box = webdriver.find_element_by_id(
            'Pl_Core_T8CustomTriColumn__3')
        focus_box.find_element_by_link_text("关注").click()


if __name__ == '__main__':
    weibo = LoginController('13951640490', 'gongyong505.')
    weibo.login()
    time.sleep(5)
    weibo.browser.get('http://weibo.com/545352510')
    time.sleep(3)
    FriendHomePage.focus_action(weibo.browser)
    FocusPage.next_page_action(weibo.browser)
    f = FollowShipControl()
    f.fouces_friend_of_comment(weibo.browser)
    weibo_list = WeiboPageCommon.get_all_weibo(weibo.browser)
    time.sleep(3)
    for weibo_driver in weibo_list:
        wei = WeiboPageCommon.weibo_parse(weibo_driver)
        if wei.comment_num > 0:
            WeiboPageCommon.comment_action(weibo_driver)
            comment_list = WeiboPageCommon.comment_list(weibo_driver)
            comment = WeiboPageCommon.comment_parse(comment_list[0])
            url = comment[0]
            weibo.browser.get(url)
            FriendHomePage.focus_action(weibo.browser)
            break

    print ''