Skip to content

Instantly share code, notes, and snippets.

@nickfox-taterli
Created June 20, 2020 09:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save nickfox-taterli/acdc2a01cf071e4c5cb73fa9e4f28c00 to your computer and use it in GitHub Desktop.
Save nickfox-taterli/acdc2a01cf071e4c5cb73fa9e4f28c00 to your computer and use it in GitHub Desktop.
Office 365 教育版注册
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