Python operation IE

Source: Internet
Author: User
#===================================================== ======================## Python operation IE login to Renren #2012/07/29 20:05:11 #================ ========================================================== ====#-*-coding: UTF-8 -*-#! /User/bin/env python
Import win32com. clientfrom time import sleeploginurl = 'HTTP: // www.renren.com/syshome.do'username+'user name 'password+'password 'ie = win32com. client. dispatch ("InternetExplorer. application.1 ") ie. visible = 1try: ie. navigate (loginurl) state = ie. readyState print u "Open login page" while 1: state = ie. readyState if state = 4: break sleep (1) print u "Page loaded, enter the user name and password" state = None ie. document. getElementById ("email "). value = username ie. document. getElementById ("password "). value = password ie. document. getElementById ("login "). click () while 1: state = ie. readyState print state if state = 4 and 'HTTP: // www.renren.com/your id' has been STR (ie. document. URL): break sleep (1) # sleep (4) print ie. document. URL print ie. document. body. innerHTML # ie. quit () Does T Exception, e: ie. quit () print 'err: ', e pass

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.