import time
from selenium import webdriver
browser = webdriver.Safari()
browser.get('http://weibo.com')
time.sleep(20)
# 點擊頁面中的登錄按鈕 彈出輸入帳號模態框
browser.find_element_by_xpath("//a[@node-type='loginBtn']").click()
time.sleep(2)
#輸入帳號密碼
browser.find_element_by_css_selector('div.item.username.input_wrap input.W_input').send_keys('yourusername')
browser.find_element_by_css_selector('div.item.password.input_wrap input.W_input').send_keys('yourpassword')
time.sleep(1)
#點擊登錄
browser.find_element_by_xpath("//div[@class='item_btn']/a[@suda-data='key=tblog_weibologin3&value=click_sign']").click()
time.sleep(10)
#查找頁面中的所有 點贊按鈕
allzan = browser.find_elements_by_css_selector('em.W_ficon.ficon_praised.S_txt2')
#遍歷 點擊
for temp in allzan:
print("again")
time.sleep(1)
temp.click()
# browser.quit()