forked from gongxiaoai/Python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcsdn.py
More file actions
17 lines (15 loc) · 713 Bytes
/
Copy pathcsdn.py
File metadata and controls
17 lines (15 loc) · 713 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# -*- coding: utf-8 -*-
"""
Created on Sat Mar 17 18:30:06 2018
@author: Administrator
"""
from selenium import webdriver
## 创建浏览器对象
browser = webdriver.Firefox()
## 打开小米社区网站
browser.get('https://passport.csdn.net/account/login')
browser.find_element_by_xpath("//*[@id='username']").clear()#清空输入框
browser.find_element_by_xpath("//*[@id='password']").clear()#清空输入框
browser.find_element_by_xpath("//*[@id='password']").send_keys("cSdN153963")#输入密码
browser.find_element_by_xpath("/html/body/div[4]/div/div/div[2]/div/div[1]/div/form/input[8]").click()#登录