作者:梦一针
1、登录QQ邮箱 url='https://mail.qq.com/cgi-bin/loginpage' 用户名,密码分别为u,p,login_button
- # _*_ coding:utf-8 _*_
- from selenium import webdriver
- from selenium.webdriver.common.action_chains import ActionChains
- import time
- driver = webdriver.Chrome('C:\\Program Files (x86)\\Google\\Chrome\\Application\\chromedriver.exe')
- driver.maximize_window()
- driver.get('https://mail.qq.com/cgi-bin/loginpage')
- time.sleep(5)
- driver.find_element_by_name('u').send_keys('2574674466')
- driver.find_element_by_name('p').send_keys('')
- driver.find_element_by_id('login_button').click()
复制代码
执行后-无法输入用户名,密码 由于登录窗口有-frame,需要先切换-再执行 需要加上:
driver.switch_to.frame("login_frame")
- driver = webdriver.Chrome('C:\\Program Files (x86)\\Google\\Chrome\\Application\\chromedriver.exe')
- driver.maximize_window()
- driver.get('https://mail.qq.com/cgi-bin/loginpage')
- time.sleep(5)
- driver.switch_to.frame("login_frame")
- driver.find_element_by_name('u').send_keys('2574674466')
- driver.find_element_by_name('p').send_keys('')
- driver.find_element_by_id('login_button').click()
复制代码
作者分享:
|