自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(137)
  • 问答 (3)
  • 收藏
  • 关注

原创 win10,python2.7,mysql-connector-python 报错 mysql.connector.errors.InternalError: Unread result found

Traceback (most recent call last): File "C:/Users/rHotD/Documents/Work/apollo_test_case_2/testcase/test_mysql.py", line 26, in <module> cur.close() File "C:\Program Files\Python2.7\lib\site-pac

2017-05-31 16:09:45 3645 1

原创 Memcached,Redis, MongoDB的区别

1.MemcachedMemcached的优点:Memcached可以利用多核优势,单实例吞吐量极高,可以达到几十万QPS(取决于key、value的字节大小以及服务器硬件性能,日常环境中QPS高峰大约在4-6w左右)。适用于最大程度扛量。支持直接配置为session handle。Memcached的局限性:只支持简单的key/value数据结构,不像Redis可以支持丰富的数据类型。无法进行持久

2017-05-31 10:17:02 1628

原创 置信区间与置信水平

在统计学中,一个概率样本的置信区间(Confidence interval),是对这个样本的某个总体参数的区间估计。置信区间展现的是,这个总体参数的真实值有一定概率落在与该测量结果有关的某对应区间。置信区间给出的是,声称总体参数的真实值在测量值的区间所具有的可信程度,即前面所要求的“一定概率”。这个概率被称为置信水平。举例来说,如果在一次大选中某人的支持率为55%,而置信水平0.95上的置信区间是(

2017-05-31 09:54:02 15264

转载 数据埋点是什么?设置数据埋点的意义?

所谓“埋点”,是数据采集领域(尤其是用户行为数据采集领域)的术语,指的是针对特定用户行为或事件进行捕获、处理和发送的相关技术及其实施过程。埋点的技术实质,是先监听软件应用运行过程中的事件,当需要关注的事件发生时进行判断和捕获,然后获取必要的上下文信息,最后将信息整理后发送至服务器端。所监听的事件,通常由操作系统、浏览器、APP框架等平台提供,也可以在基础事件之上进行触发条件的自定义(如点击某一个特定

2017-05-31 09:49:57 23270

原创 pip 安装 django 报错 UnicodeEncodeError: 'ascii' codec can't encode character u'\u258f' in position 8: o

使用此种方式即可

2017-05-24 10:13:54 1272

原创 unittest 基础之 —— TestSuite

深入解读Python的unittest模块如何创建这些Testcase或者TestSuite?1.自己手动实例化TestCase,这个上面已经有例子,与普通类无异,这中在自动化领域用处不大2.利用C:\Python27\Lib\unittest\loader.py模块的TestLoader,该类提供了多种不同情境find testcase。1.loadTestsFromTestCase利用给出的Te

2017-05-23 13:35:22 700

原创 配置 Pycharm 默认 Test runner 的方法

由图中可见,当前使用的是 unittest 测试框架修改方式如下:

2017-05-23 13:31:48 5913

原创 unittest 基础之 —— TestCase

深入解读Python的unittest并拓展HTMLTestRunnerunnitest 就是unnitest=TestCase+TestResult ,到其实最终执行的是 TestCase 中的run方法,并把结果给 TestResult(或它的子类)。import unittestclass Mydemo(unittest.TestCase): def setUp(self):

2017-05-23 00:22:14 2845

原创 unittest 中用于 skip 跳过 test method, test class,的相关装饰器

可以使用unitest.skip装饰器族跳过test method或者test class,这些装饰器包括: ① @unittest.skip(reason):无条件跳过测试,reason描述为什么跳过测试 ② @unittest.skipif(conditition,reason):condititon为true时跳过测试 ③ @unittest.skipunless(condition,r

2017-05-22 23:50:03 5492

原创 import pylibconfig2 报错的解决方案

C:\Windows\system32>pythonPython 2.7 (r27:82525, Jul 4 2010, 07:43:08) [MSC v.1500 64 bit (AMD64)] on win32Type "help", "copyright", "credits" or "license" for more information.>>> import pylibconf

2017-05-22 11:04:48 1333

原创 使用 webdriver 从标签中获取文本内容的方法

bucket_text = driver.find_element_by_xpath('//p[@class="bucket-text"]').get_attribute('textContent') print(bucket_text)使用driver.find_element_by_xpath('').get_attribute('textContent') 来获取指定节点中的

2017-05-19 16:02:08 16074 3

原创 安装第三方包的时候报错 IOError: [Errno 13] Permission denied: 'C:\\Program Files\\Python2.7\\Lib\\site-packages

原因是未使用超级管理员权限解决办法:打开 cmd 窗口的时候,使用管理员权限即可安装一个破包居然安装了小半个上午…

2017-05-19 11:37:22 3566 1

原创 使用 webdriver报错 ElementNotInteractableException: Message: 的解决办法

睡几秒就好了…

2017-05-17 17:38:48 18697 7

原创 python 基础 —— "%s" 与 "%r" 的区别

%r是repr %s是str比如\x27是单引号>>> print '%r'%'\x27' # 带括号的单引号"'" >>> print '%s'%'\x27' # 纯单引号'>>> class Example(object): ... __repr__ = lambda cls: '<Demo>(repr)'... __str__ = lambda cls: '<

2017-05-17 16:39:27 748

原创 在 unittest 中使用 logging 模块记录测试数据

# -*- coding:utf-8 -*-import sysimport loggingimport unittestimport osreload(sys)sys.path.append(os.path.dirname(os.path.abspath(__file__)) + r'\..') # 返回脚本的路径logging.basicConfig(level=logging.D

2017-05-17 15:08:11 4600

原创 使用 win10+python 2.7 连接 mysql 的方法

安装 MySQL-Python需要安装 vc++ 9.0 Microsoft Visual C++ Compiler for Python 2.7依旧报错据说是缺少 MySQL-Python 的驱动啥的,然而下载了之后再次尝试了一次,还是不成,可能是因为我使用的是 win10 的缘故再次尝试 MySQL-connector应该是 缺少 Protobuf C++Protocol Buffers

2017-05-17 12:12:50 1646

原创 使用 Selenium 将滚动条移动到目标元素位置的方法

from selenium.webdriver.common.action_chains import ActionChainsscroll_add_crowd_button = driver.find_element_by_xpath(xpath_button_add_crowd)driver.execute_script("arguments[0].scrollIntoView();", scr

2017-05-16 18:13:42 10432 2

原创 使用 selenium 模拟 鼠标悬浮 在目标元素上的方法

from selenium.webdriver.common.action_chains import ActionChains# 定位 添加条件 按钮,经观需要鼠标悬停xpath_button_add_condition = '//span[contains(text(),"添加条件")]'move_on_to_add_condition = driver.find_element_by_xpa

2017-05-16 18:12:09 4551 1

原创 报错 MoveTargetOutOfBoundsException 的解决办法

# 将 滚动条 拖动到 xxxx 按钮,上端对齐scroll_add_crowd_button = driver.find_element_by_xpath(xpath_button_add_crowd)driver.execute_script("arguments[0].scrollIntoView();", scroll_add_crowd_button)# 定位 添加条件 按钮,经观需要鼠

2017-05-16 18:10:27 8811

原创 python 基础 —— join() 方法

In [4]: a=[i for i in range(10)]In [5]: aOut[5]: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]In [7]: str(a)Out[7]: '[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]'In [8]: map(str,a)Out[8]: <map at 0x252fffd1be0>In [9]: b=list(ma

2017-05-16 13:38:04 764

原创 xpath 获取当前节点的父节点,兄弟节点的方法

xpath_input_exp_mark = '//label[contains(text(), "文本内容")]/../following-sibling::div[1]//input'browser.find_element_by_xpath(xpath_input_exp_mark).. 表示当前节点的父节点following-sibling::div[1] 表示当前节点的兄弟节点中的 第 1

2017-05-16 10:44:33 46434

原创 python 基础 —— 获取当前时间的时间戳

In [1]: import timeIn [2]: time.time()Out[2]: 1494902382.2486684In [3]: int(time.time())Out[3]: 1494902387

2017-05-16 10:40:27 56451

原创 使用 xpath 定位包含指定文本内容的标签

browser.find_element_by_xpath('//button/span[contains(text(), "指定文本内容")]').click()指定文本内容 可以是 匹配全部文本 也可是 匹配部分文本

2017-05-16 10:14:46 39842 1

原创 基于《Selenium 2自动化测试实战》的学习笔记(11)—— 设置等待时间

sleep():设置固定休眠时间。python 的 time 包提供了休眠方法 sleep() ,导入time 包后就可以使用 sleep() 进行脚本的执行过程进行休眠。implicitly_wait():是 webdirver 提供的一个超时等待。隐的等待一个元素被发现,或一个命令完成。如果超出了设置时间的则抛出异常。WebDriverWait():同样也是webdirver 提供的方法。在设置

2017-05-13 00:56:03 1599

原创 设置 PhantomJs 的 User-Agent 的方法

class BaseTest(unittest.TestCase): @classmethod def setUpClass(cls): fire_fox_user_agent = "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:53.0) Gecko/20100101 Firefox/53.0" dcap = dict(Desire

2017-05-12 23:56:11 3372 1

原创 基于《Selenium 2自动化测试实战》的学习笔记(10)—— 打印信息

通常我们可以通过获得页面的title 、URL 地址,页面上的标识性信息(如,登录成功的“欢迎,xxx”信息)来判断用例执行成功。#coding=utf-8from selenium import webdriverdriver = webdriver.Firefox()driver.get("xxx")#登录driver.find_element_by_id("user_name").cl

2017-05-12 23:53:32 794

原创 python 基础 —— logging 模块

1.简单的将日志打印到屏幕In [1]: import loggingIn [2]: logging.debug('this is debug message')In [3]: logging.info('this is info message')In [4]: logging.warning('this is warning message')WARNING:root:this is warn

2017-05-12 17:41:47 517

原创 大菠萝实习日记(1)

入职 报到 吃午饭 搭环境小姐姐来了之后,给我们大致介绍了一下工作的内容与流程,虽然听得一头雾水,但是,好像我的工作就是使用 selenium + 某某浏览器 在 用于测试工作的前端页面 进行模拟用户操作,并时刻截屏。小姐姐说, 在用 PhantomJS 截屏的时候, 与用户正常登陆时的前端页面不同。让我们试图查找一下原因。现在表示测试的步骤是使用 print(), 这种方式太过初级,考虑使用

2017-05-12 00:11:34 691

原创 python 基础 —— platform 模块

import platform platform.platform() #获取操作系统名称及版本号,'Windows-7-6.1.7601-SP1' platform.version() #获取操作系统版本号,'6.1.7601' platform.architecture() #获取操作系统的位数,('32bit', 'WindowsP

2017-05-11 23:57:29 799

原创 python 基础 —— 获取文件路径

# -*- coding:utf-8 -*-import osimport sys# 当前文件在系统中的绝对路径print(os.path.abspath(__file__))# 上级目录print(os.path.pardir)# 当前文件及兄弟文件(夹)print(os.path.join(os.path.dirname(__file__), os.path.pardir))# 当前文

2017-05-11 23:52:22 1171

原创 python 基础 —— sys.path 与 sys.path.append

sys.path指定模块搜索路径的字符串列表。 从环境变量PYTHONPATH初始化,加上依赖于安装的默认值。在程序启动时初始化,此列表的第一个项目path [0]是包含用于调用Python解释器的脚本的目录。 如果脚本目录不可用(例如,如果解释器被交互地调用或者如果从标准输入读取脚本),则路径[0]是空字符串,它将Python引导到当前目录中的搜索模块。 请注意,在PYTHONPATH结果插入的条

2017-05-11 23:48:37 11508

原创 Leetcode学习(43)—— Relative Ranks

Given scores of N athletes, find their relative ranks and the people with the top three highest scores, who will be awarded medals: “Gold Medal”, “Silver Medal” and “Bronze Medal”.Example 1:Input: [5,

2017-05-11 16:53:17 516

原创 python 基础 —— enumerate()

enumerate() 函数返回可迭代对象的下标(计数)和原数据第一个参数为 可迭代对象 第二个参数为 计数的起始值In [1]: a=[0]*10In [2]: aOut[2]: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]In [3]: enumerate(a)Out[3]: <enumerate at 0x1c5d48f3510>In [4]: list(enumerate

2017-05-11 16:30:00 485

原创 Leetcode学习(42)—— Assign Cookies

Assume you are an awesome parent and want to give your children some cookies. But, you should give each child at most one cookie. Each child i has a greed factor gi, which is the minimum size of a cook

2017-05-11 15:21:25 390

原创 SecureCRT和FX 的下载激活方法

http://jingyan.baidu.com/article/afd8f4de98ced134e286e9b5.htmlhttp://download.csdn.net/detail/pzhier/9704897?web=web具体详情见原文

2017-05-11 13:50:37 2393

原创 Leetcode学习(41)—— Find All Anagrams in a String

Given a string s and a non-empty string p, find all the start indices of p’s anagrams in s.Strings consists of lowercase English letters only and the length of both strings s and p will not be larger t

2017-05-10 14:59:56 497

原创 python 基础 —— collections.Counter()

CounterCounter是一个简单的计数器,例如,统计字符出现的个数.测试:In [1]: from collections import CounterIn [2]: p='asdsaddsdasda'In [3]: Counter(p)Out[3]: Counter({'a': 4, 'd': 5, 's': 4})In [4]: type(Counter(p))Out[4]: coll

2017-05-10 14:44:05 538

原创 Leetcode学习(40)—— Valid Anagram

Given two strings s and t, write a function to determine if t is an anagram of s.For example,s = "anagram", t = "nagaram", return true.s = "rat", t = "car", return false.Note: You may assume the str

2017-05-10 14:18:27 443

原创 Leetcode学习(39)—— Majority Element

Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times.You may assume that the array is non-empty and the majority element always

2017-05-09 23:31:27 569

原创 Leetcode学习(38)—— First Unique Character in a String

Given a string, find the first non-repeating character in it and return it’s index. If it doesn’t exist, return -1.Examples:s = "leetcode"return 0.s = "loveleetcode",return 2. Note: You may assume

2017-05-09 18:07:37 468

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除