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 然后,你 ...
随机推荐
- centos 7 中安装Oracle 12c
今天有需要在centos 7上安装oracle 12 所以上网查了一下安装流程,原贴转自:https://blog.csdn.net/github_39294367/article/details/7 ...
- ajax-jq
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...
- Java checked异常 和 RuntimeException
RuntimeException RuntimeException是非常特殊的子类,你可以不用throw和throws. 哪怕你throw了,也没必要throws,即使你throws了,调用者也没必要 ...
- delphi RichView的使用介绍
RichView 组件 由 9 个组件模块组成,分别是: 1.TRVStyle:主要是定义RICHVIEW样式,定义后,其它RIHCVIEW都可以引用此样式. 2.TRichView :主要用于显示 ...
- NX二次开发-创建直线(起点-向量方向-长度)UF_CURVE_create_line
NX9+VS2012 #include <uf.h> #include <uf_curve.h> #include <uf_csys.h> #include < ...
- 关于C++里set_intersection(取集合交集)、set_union(取集合并集)、set_difference(取集合差集)等函数的使用总结
文章转载自https://blog.csdn.net/zangker/article/details/22984803 set里面有set_intersection(取集合交集).set_union( ...
- Try running RemoteDll as Administrator
在使用RemoteDll注入动态库的时候发现注入有的动态库会提示下面的错误, LoadLibrary on remote process [1968 - Explorer.exe] failed. T ...
- 数据结构C++版-线性表
PS:资料来源慕课网视频. 一.什么是线性表 线性表是n个数据元素的有限序列. 分类: 二.补充知识点 1.栈和队列有出操作.入操作,对应线性表(数组)为插入元素和删除元素,而线性表中要获取指定元素值 ...
- kafka集群配置总结
虽然很简单,但会遇到很多奇怪的坑,而且网上解决方法搜不到. 首先下载kafka包,解压缩后,修改conf/server.properties文件,基本配置项如下(省略了部分默认配置项 : broker ...
- SPSS数据记录的选择(Select Cases)
SPSS数据记录的选择(Select Cases) 在数据分析时,有时可能只对某些记录感兴趣.例如,在判别分析时,可能用其中90%的记录数据建立判别函数,用其余10%的记录来考核判别函数.此时,可以通 ...