#练习:登录163邮箱然后新建一个联系人 import unittest import time from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver import ActionChains from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.su…
前三篇文章介绍了安装过程和通过Selenium实现访问Firefox浏览器并自动搜索"Eastmount"关键字及截图的功能.而这篇文章主要简单介绍如何实现自动登录163邮箱,同时继续介绍Selenium+Python官网Locating Elements部分内容.        希望该篇基础性文章对你有所帮助,如果有错误或不足之处,请海涵~        [Python爬虫] 在Windows下安装PhantomJS和CasperJS及入门介绍(上)        [Python爬虫…
1.Selenium实现自动化,需要定位元素,以下查看163邮箱的登录元素 (1)登录(定位到登录框,登录框是一个iframe,如果没有定位到iframe,是无法定位到账号框与密码框) 定位到邮箱框(name='email') 定位到密码框(name='password') 定位到登录按钮(id="dologin") 2.代码实现 #coding=utf-8 import time from selenium import webdriver broswer = webdriver.I…
最近在看python网络爬虫,于是我想自己写一个邮箱和QQ空间的自动登录的小程序, 下面以登录163邮箱和QQ空间和为例: 了解到在Web应用中经常会遇到frame/iframe 表单嵌套页面的应用,WebDriver 只能在一个页面上对元素识别与定位,对于frame/iframe 表单内嵌页面上的元素无法直接定位.这时就需要通过switch_to.frame()方法将当前定位的主体切换为frame/iframe 表单的内嵌页面中 # -*- coding: utf-8 -*-""&q…
思路:使用python自带的unittest单元测试框架测试163邮箱登录成功的case import unittestfrom selenium import webdriverimport time#定义登录类,登录相关的case都可以在这里 class LoginCase(unittest.TestCase): #每个用例开始前的准备 def setUp(self): print("开始测试") self.dr=webdriver.Chrome() self.dr.get(&qu…
配置文件:UiObjectMapSendMap.ini用来存放配置信息 GetOptionSendMail.py 用来读取配信息 #encoding=utf-8from selenium.webdriver.support.ui import WebDriverWaitimport ConfigParserimport osfrom selenium import webdriver class GetOption(object):    def __init__(self):        #…
imacros免费版 登录宏代码的示例: //首先登出URL GOTO=http://yoursite/logout.html//打开登录页面URL GOTO=http://yoursite/login.html //输入用户名 TAG POS= TYPE=INPUT:TEXT FORM=ACTION:http://yoursite/login.html ATTR=NAME:username CONTENT=登录用户名 //输入密码 SET !ENCRYPTION NO TAG POS= TYP…
脚本内容:#encoding=utf-8#author-夏晓旭from selenium import webdriverimport timefrom selenium.webdriver.support.ui import WebDriverWaitfrom selenium.webdriver.common.by import Byfrom selenium.common.exceptions import TimeoutException, NoSuchElementExceptioni…
环境:windows8  python2.7+selenium+chrome 直接上脚本: # coding=utf-8from selenium import webdriverimport timeurl='https://mail.163.com/'loginname='username@163.com'password='12345678'browser = webdriver.Chrome()browser.get(url)browser.maximize_window()time.s…
1.场景 很多时候登录操作是比较复杂的,因为存在各种反爆破操作,以及为了安全性提交数据都会存在加密.如果要完全模拟代码去实现登录操作是比较复杂,并且该网站后续更新了登录安全相关功能,那么登录的模拟操作又得修改.但是通过selenium模拟人为登录得操作是永远不会过时.因此一个好得方案就是通过selenium模拟登录,然后拿到可用得Cookie通过requests进行后续得模拟请求. 2.实现代码 import time, requests from selenium import webdriv…