Selenium real-day script set-Sina Weibo sends QQ Daily Focus (Firefox)

Source: Internet
Author: User

Selenium actual Combat script set (1)-Sina Weibo to send QQ daily focus, ethanol with Google implementation, the bottom is implemented with Firefox.

The code is as follows:
#coding = Utf-8 fromSeleniumImportWebdriverImportTimeprofiles= Webdriver. Firefoxprofile ("c:/documents and Settings/administrator/application data/mozilla/firefox/profiles/rhw9fq7m.default") Driver=Webdriver. Firefox (Profiles) Driver.get ("http://www.qq.com") Today= Driver.find_element_by_css_selector ("#todaytop a") Content=Today.texturl= Today.get_attribute ("href")PrintContent.encode ("Utf-8")PrintUrldriver.get ("http://www.weibo.com") Time.sleep (5) Driver.find_element_by_css_selector ("textarea. W_input"). Send_keys (content+URL) driver.find_element_by_css_selector ("a.w_btn_a.btn_30px"). Click () time.sleep (5) Driver.close ()
Common errors

XP and Win7 below Chrome's profile path is not the same

    • Windows xp:%userprofile%\local Settings\Application Data\mozilla\firefox\profiles\ or%USERPROFILE%\Application Data\ Mozilla\firefox\profiles\
    • Windows vista/windows 7/windows 8:%localappdata%\mozilla\firefox\profiles\

Selenium real-day script set-Sina Weibo sends QQ Daily Focus (Firefox)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.