selenium python bindings 项目结构总结
一个合理的文档结构在import的过程中会避免很多错误,踩完坑来记录。
webtests/
framework.py
webdriver.py
test_file.py
module/
__init__.py
PageObjects/
__init__.py
all_pages.py
object.py
上面这个丑丑的就是修改完后比较合理正确的一个文档结构。
说明:
1. 以test_开头命名所有的testcase文件
2. 抽出公共的方法到framework中
3. webdriver 中要声明执行的testcase的位置
4. module中的__init__.py 文件们。这些init文件有的是包含了你所要import的内容,有的只是空。这是出自python的定义,为了指示这是一个module,可以从这里面import你所需要的类,在module的各级目录里都添加了init的文件
The __init__.py files are required to make Python treat the directories as containing packages; this is done to prevent directories with a common name, such as string, from unintentionally hiding valid modules that occur later on the module search path. In the simplest case, __init__.py can just be an empty file, but it can also execute initialization code for the package or set the __all__ variable, described later.
5. object.py中的内容是一个页面的页面元素抽象以及页面通用方法
6. all_pages.py可以在framework中被import,这个文件中是import了所有的object.py文件中的类
selenium python bindings 项目结构总结的更多相关文章
- selenium python bindings 元素定位
1. 辅助 Firepath Firefox是所有做前端的必不可少的浏览器因为firebug的页面元素显示很清晰.用selenium 去定位元素的时候Firefox还有一个非常友好的工具就是firep ...
- <译>Selenium Python Bindings 1 - Installation
Installation Introduction Selenium Python bindings 提供了一个简单的API来使用Selenium WebDriver编写使用功能/验收测试.通过Sel ...
- python的项目结构
项目结构 知识点 创建项目,编写 __init__ 文件 使用 setuptools 模块,编写 setup.py 和 MANIFEST.in 文件 创建源文件的发布版本 项目注册&上传到 P ...
- <译>Selenium Python Bindings 5 - Waits
如今,大多数的Web应用程序使用AJAX技术.当页面加载到浏览器,页面中的元素也许在不同的时间间隔内加载.这使得元素很难定位,如果在DOM中的元素没有呈现,它将抛出ElementNotVisibleE ...
- <译>Selenium Python Bindings 2 - Getting Started
Simple Usage如果你已经安装了Selenium Python,你可以通过Python这样使用: #coding=gbk ''' Created on 2014年5月6日 @author: u ...
- selenium python bindings 初步用法及简单参考例子
掌握selenium最简单的方法就是参考例子进行学习,下面给出之前项目的测试例子及分析 # -*- coding: utf-8 -*- import time from selenium import ...
- python flask 项目结构
1. 今天学习遇到一个问题,以前项目比较简单,所有的@app.route 都是写在一个文件app.py 中的,然后启动也是在这个文件中启动app.run .但是我今天 想写一个新的模块, 于是我新启了 ...
- selenium python bindings 写测试用例
这章总结selenium在UI测试方面的用法 import unittest from selenium import webdriver from selenium.webdriver.common ...
- <译>Selenium Python Bindings 6 - WebDriver API
本章涉及Selenium WebDriver的所有接口. Recommended Import Style 推荐的导入风格如下: from selenium import webdriver 然后,你 ...
随机推荐
- __stdcall,__cdecl,__fastcall,_stdcall,_cdecl,_fastcall 区别简介[转]
今天写线程函数时,发现msdn中对ThreadProc的定义有要求: DWORD WINAPI ThreadProc(LPVOID lpParameter); 不解为什么要用WINAPI宏定义,查 ...
- vue组件添加鼠标滚动事件
在一个组件标签上加鼠标滚动事件,应该写成 @mousewheel.native
- leetcood学习笔记-437-路径总和③**
题目描述: 方法一:栈 class Solution(object): def pathSum(self, root, sum): """ :type root: Tre ...
- HIVE的安装步骤及遇到的问题及解决方法
一.root 用户 解压安装包 二 chown -R hadoop:hadoop apache-hive-1.2.2-bin/ chmod -R 755 apache-hive-1 ...
- 使用JS实现快速排序
大致分三步: 1.找基准(一般是以中间项为基准) 2.遍历数组,小于基准的放在left,大于基准的放在right 3.递归 function quickSort(arr){ //如果数组<=1, ...
- shell 脚本定制与重定向
脚本定制 . 或者 source: 读取文本文件并执行(在当前shell解释并执行) source ./ld 总用量 8 -rw-------. 1 root root 1223 10月 2 21:1 ...
- Django -- 分页 -- 批量导入
Django -- 分页 分页 Django提供了一些类实现管理数据分页,这些类位于django/core/paginator.py中 Paginator对象 Paginator(列表,int):返 ...
- TopCoder[TCO2016 Round 1A]:EllysTree(1000)
Problem Statement Elly has a graph with N+1 vertices, conveniently numbered from 0 to N. The gr ...
- Delphi实现屏幕截图、窗口截图、指定区域截图
Use Jpeg procedure TForm1.snapscreen(a,b,c,d:Integer); var bmpscreen:Tbitmap; jpegscreen:Tjpegimage; ...
- 在DELPHI中显示GIF动画
想没想过在DELPHI中显示GIF动画?Delphi的用户是非常幸运的,因为有免费控件可以使用.最著名的控件是Anders Melander编写的TGifImage,并提供完整的源程序.它原来的主页是 ...