# -*- coding: utf-8 -*- 
from selenium import webdriver 
import time 
 
driver =webdriver.PhantomJS() 
driver.maximize_window() 
 
def get_shuoshuo(): 
    driver.get('https://user.qzone.qq.com/177472465') 
 
    try: 
        driver.find_element_by_id('login_div') 
        a = True 
    except: 
        a = False 
 
    if a==True: 
        driver.switch_to.frame('login_frame') 
        driver.find_element_by_id('switcher_plogin').click() 
        driver.find_element_by_id('u').clear() 
        driver.find_element_by_id('u').send_keys('29') 
        driver.find_element_by_id('p').clear() 
        driver.find_element_by_id('p').send_keys('we2') 
        driver.find_element_by_id('login_button').click() 
        time.sleep(3) 
    driver.implicitly_wait(3) 
 
    try: 
        driver.find_element_by_id('QM_OwnerInfo_Icon') 
        b = True 
    except: 
        b = False 
 
 
    if b==True: 
        time.sleep(3) 
        driver.switch_to.frame('QM_Feeds_Iframe') 
        content =driver.find_element_by_id('host_home_feeds').get_attribute('innerHTML') 
        print content 
    driver.close() 
    driver.quit() 
 
if __name__ == '__main__': 
    get_shuoshuo()

https://zhuanlan.zhihu.com/p/25006226

发布评论

分享到:

IT源码网

微信公众号号:IT虾米 (左侧二维码扫一扫)欢迎添加!

python登录知乎讲解
你是第一个吃螃蟹的人
发表评论

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。