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