摘要: #!usr/bin/env python #-*- coding:utf-8 -*- #禁用Firefox浏览器中的CSS、Flash及Image加载 from selenium import webdriver import time,unittest class TestDemo(unittest.TestCase): def setUp(self): #创... 阅读全文
posted @ 2018-01-13 12:15 sleeping_cat 阅读(392) 评论(0) 推荐(0) 编辑
摘要: #!usr/bin/env python #-*- coding:utf-8 -*- #禁用Chrome浏览器中的Image加载 from selenium import webdriver import time,unittest from selenium.webdriver.chrome.options import Options class TestDemo(unittest... 阅读全文
posted @ 2018-01-13 12:14 sleeping_cat 阅读(415) 评论(0) 推荐(0) 编辑
摘要: #!usr/bin/env python #-*- coding:utf-8 -*- #启用Firefox的同时打开Firebug from selenium import webdriver from selenium.webdriver.common.keys import Keys import time,unittest class TestDemo(unittest.Test... 阅读全文
posted @ 2018-01-13 12:13 sleeping_cat 阅读(174) 评论(0) 推荐(0) 编辑
摘要: #!usr/bin/env python #-*- coding:utf-8 -*- #禁用IE的保护模式 from selenium import webdriver from selenium.webdriver.common.desired_capabilities import DesiredCapabilities import unittest,time class Tes... 阅读全文
posted @ 2018-01-13 12:11 sleeping_cat 阅读(452) 评论(0) 推荐(0) 编辑
摘要: #!usr/bin/env python #-*- coding:utf-8 -*- #禁用Chrome浏览器的PDF和Flash插件 from selenium import webdriver from selenium.webdriver.chrome.options import Options import unittest,time class TestDemo(unitt... 阅读全文
posted @ 2018-01-13 12:10 sleeping_cat 阅读(280) 评论(0) 推荐(0) 编辑
摘要: 屏蔽WebDriver启动Chrome实例时总出现的“--ignore-certificate-errors”提示信息,同时禁用Chrome浏览器的插件,并且让浏览器窗口最大化。 #!usr/bin/env python #-*- coding:utf-8 -*- #屏蔽Chrome的--ignore-certificate-errors提示及禁用扩展插件并实现窗口最大化 from se... 阅读全文
posted @ 2018-01-13 12:07 sleeping_cat 阅读(10653) 评论(0) 推荐(0) 编辑
摘要: 更改PC端Chrome浏览器的属性值,将PC端Chrome浏览器设定为手机端尺寸的浏览器。 #!usr/bin/env python #-*- coding:utf-8 -*- #修改Chrome设置伪装成手机M站 from selenium import webdriver import unittest,time class TestDemo(unittest.TestCase):... 阅读全文
posted @ 2018-01-13 12:02 sleeping_cat 阅读(2754) 评论(0) 推荐(0) 编辑
摘要: #!usr/bin/env python #-*- coding:utf-8 -*- #使用Chrome浏览器自动将文件下载到指定路径 from selenium import webdriver import unittest,time class TestDemo(unittest.TestCase): def setUp(self): chromeOpti... 阅读全文
posted @ 2018-01-13 11:57 sleeping_cat 阅读(2899) 评论(0) 推荐(0) 编辑
摘要: 读取HTML5的localStorahe和sessionStorage的内容,并删除存储的内容。 #!usr/bin/env python #-*- coding:utf-8 -*- #操作HTML5存储对象 from selenium import webdriver import unittest,time class Html5Storage(unittest.TestCase)... 阅读全文
posted @ 2018-01-13 11:56 sleeping_cat 阅读(720) 评论(0) 推荐(0) 编辑
摘要: #!usr/bin/env python #-*- coding:utf-8 -*- #在HTML5的画布元素上进行绘画操作 import unittest,time from selenium import webdriver class TestDemo(unittest.TestCase): def setUp(self): self.driver = w... 阅读全文
posted @ 2018-01-13 11:47 sleeping_cat 阅读(588) 评论(0) 推荐(0) 编辑
摘要: 获取HTML5语言实现的视频播放器视频文件的地址、时长,控制播放器进行播放或暂停播放等操作。 #!usr/bin/env python #-*- coding:utf-8 -*- #测试HTML5语言实现的视频播放器 import unittest from selenium import webdriver import time class TestDemo(unittest.Te... 阅读全文
posted @ 2018-01-13 11:43 sleeping_cat 阅读(924) 评论(0) 推荐(1) 编辑
摘要: 设置文本框属性 第一行第一列 第一行第二列 第一行第... 阅读全文
posted @ 2018-01-13 11:06 sleeping_cat 阅读(259) 评论(0) 推荐(0) 编辑
摘要: 1.获取当前的日期及时间,用于生成保存截图文件目录名 #!usr/bin/env python #-*- coding:utf-8 -*- import time from datetime import datetime ''' 本文件主要用于获取当前的日期以及时间 用于生成保存截图文件目录名 ''' def currentDate(): date = time.localtim... 阅读全文
posted @ 2018-01-13 11:02 sleeping_cat 阅读(795) 评论(0) 推荐(0) 编辑
摘要: #!usr/bin/env python #-*- coding:utf-8 -*- """ ab @author: sleeping_cat @Contact : zwy24zwy@163.com """ #浏览器中新开标签页(Tab) import unittest from selenium import webdriver import time import win32... 阅读全文
posted @ 2018-01-13 10:57 sleeping_cat 阅读(1451) 评论(0) 推荐(0) 编辑
摘要: #!usr/bin/env python #-*- coding:utf-8 -*- """ @author: sleeping_cat @Contact : zwy24zwy@163.com """ #高亮显示正在操作的页面元素 import unittest from selenium import webdriver import time def highLightEle... 阅读全文
posted @ 2018-01-13 10:56 sleeping_cat 阅读(155) 评论(0) 推荐(0) 编辑
摘要: 环境: 打开CMD窗口,输入pip install pillow安装Python图像处理库,安装结束后在CMD下进入Python交互模式,执行from PIL import Image,没有报错则安装成功。 #!usr/bin/env python #-*- coding:utf-8 -*- """ @author: sleeping_cat @Contact : zw... 阅读全文
posted @ 2018-01-13 10:54 sleeping_cat 阅读(794) 评论(0) 推荐(0) 编辑
摘要: 富文本框常见的技术用到了Frame标签,并且在Frame里面实现了一个完整的HTML网页结构。 方法一: #!usr/bin/env python #-*- coding:utf-8 -*- """ @author: sleeping_cat @Contact : zwy24zwy@163.com """ #操作富文本框 from selenium import webdrive... 阅读全文
posted @ 2018-01-13 10:42 sleeping_cat 阅读(1057) 评论(0) 推荐(0) 编辑
摘要: 能够使用配置文件存储被测试页面上页面元素的定位方式和定位表达式,做到定位数据和程序的分离。 1.页面元素定位表达式配置文件,“.ini”文件,可用text文本编辑保存后直接修改文件后缀 [sogou] searchBox=id>query searchButton=id>stb 2.ObjectMap工具类文件,供测试程序调用 #!usr/bin/env python #-*- coding:... 阅读全文
posted @ 2018-01-13 10:33 sleeping_cat 阅读(449) 评论(0) 推荐(0) 编辑
摘要: #!usr/bin/env python #-*- coding:utf-8 -*- """ @author: sleeping_cat @Contact : zwy24zwy@163.com """ #操作日期控件 from selenium import webdriver import unittest,time,traceback from selenium.webdr... 阅读全文
posted @ 2018-01-13 10:23 sleeping_cat 阅读(215) 评论(0) 推荐(0) 编辑