-
-
Save Ecalose/5b4be3db0dc91d75f8031db48d5991b2 to your computer and use it in GitHub Desktop.
Office 365 教育版注册
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import time | |
| from faker import Faker | |
| from selenium import webdriver | |
| f = Faker() | |
| with open("accounts.txt") as fh: | |
| line = fh.readline() | |
| while line: | |
| email = line.strip() | |
| line = fh.readline() | |
| driver = webdriver.Chrome("C:\Program Files (x86)\Google\Chrome\Application\chromedriver.exe") | |
| driver.implicitly_wait(10) | |
| driver.get('https://www.microsoft.com/zh-cn/education/products/office') | |
| driver.find_element_by_id('pmgJS-Email').send_keys(email) | |
| time.sleep(5) | |
| driver.find_element_by_id('HowToBuy-SignUpToOffice365-GetStarted').click() | |
| # 0=>我是学生 1=>我是教师 | |
| time.sleep(5) | |
| driver.find_elements_by_class_name('disambiguationtext')[1].click() | |
| time.sleep(10) | |
| driver.find_element_by_id('LastName').send_keys(f.last_name()) | |
| driver.find_element_by_id('FirstName').send_keys(f.first_name()) | |
| driver.find_element_by_id('Password').send_keys('m$0e@zTt&$C0') | |
| driver.find_element_by_id('RePassword').send_keys('m$0e@zTt&$C0') | |
| # 输入验证码 | |
| code = input("请输入邮件验证码:") | |
| driver.find_element_by_id('SignupCode').send_keys(code) | |
| driver.find_element_by_link_text('开始').click() | |
| while True: | |
| if 'https://www.office.com/?auth=2' not in driver.current_url: | |
| time.sleep(5) | |
| else: | |
| break | |
| driver.get('https://www.office.com/launch/onedrive') | |
| time.sleep(5) | |
| driver.quit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment