Python + Selenium Implementation sign in to Office 365

Source: Internet
Author: User

Recently picked up before using Python + Selenium to implement work required to sign in to Office 365 features. (Spit Groove: The domestic network is really a card, logging into Office 365 is not easy.) In addition selenium such a site to the wall, can not understand, is said to be using Google's ip,whatever ... )

Try to study the relationship between selenium and Webdriver, read the official introduction, first excerpt a piece of interesting content:

Jump to 2008. The Beijing Olympics mark China's arrival as a global power,massive mortgage default in the all states triggers the WOR St Internationalrecession since the Great Depression, the Dark Knight is viewed by every human (twice), still reeling from The untimely loss of Heath ledger. But the mostimportant story of this year is the merging of Selenium and Webdriver.

I wanted to study the current selenium in the end which is Webdriver which is the original selenium, but later found that both seem to be integrated bright. Can be glimpse from the structure of their class:

Http://selenium.googlecode.com/git/docs/api/py/api.html

The core code for my login to Office 365 is as simple as that:

1 deflogin_o365 (self):2Self.driver =Webdriver. Firefox ()3 Self.driver.maximize_window ()4 self.driver.get (Self._login_url)5Time.sleep (5)        6Self.driver.find_element (*self._login_username_field_locator). Send_keys (Self._login_username)7Time.sleep (1)8Self.driver.find_element (*self._login_password_field_locator). Send_keys (Self._login_password)9Time.sleep (1)           TenSelf.driver.find_element (*self._login_password_field_locator). Send_keys (Keys.return) OneTime.sleep (1) ASelf.driver.find_element (*self._login_submit_button_locator). Click () -Time.sleep (20) -     Print 'Log in O365 successfully!'

Which let me toss a long time of a problem is, after entering the password, must have send a return step, otherwise click the login button will not respond, the specific reason to tell ...

Python + Selenium Implementation sign in to Office 365

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.