资源简介
自己网页自动化测试使用。selenium 包+firefox加注意事项说明,保证可以使用。
代码片段和文件信息
“““
Copyright 2011 Software Freedom Conservancy.
Licensed under the Apache License Version 2.0 (the “License“);
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing software
distributed under the License is distributed on an “AS IS“ BASIS
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
“““
from __future__ import unicode_literals
__docformat__ = “restructuredtext en“
try:
import http.client as http_client
except ImportError:
import httplib as http_client
try:
import urllib.parse as urllib_parse
except ImportError:
import urllib as urllib_parse
class selenium(object):
“““
Defines an object that runs Selenium commands.
**Element Locators**
Element Locators tell Selenium which HTML element a command refers to.
The format of a locator is:
\ *locatorType*\ **=**\ \ *argument*
We support the following strategies for locating elements:
* \ **identifier**\ =\ *id*:
Select the element with the specified @id attribute. If no match is
found select the first element whose @name attribute is \ *id*.
(This is normally the default; see below.)
* \ **id**\ =\ *id*:
Select the element with the specified @id attribute.
* \ **name**\ =\ *name*:
Select the first element with the specified @name attribute.
* username
* name=username
The name may optionally be followed by one or more \ *element-filters* separated from the name by whitespace. If the \ *filterType* is not specified \ **value**\ is assumed.
* name=flavour value=chocolate
* \ **dom**\ =\ *javascriptexpression*:
Find an element by evaluating the specified string. This allows you to traverse the HTML Document object
Model using javascript. Note that you must not return a value in this string; simply make it the last expression in the block.
* dom=document.forms[‘myForm‘].myDropdown
* dom=document.images[56]
* dom=function foo() { return document.links[1]; }; foo();
* \ **xpath**\ =\ *xpathexpression*:
Locate an element using an XPath expression.
* xpath=//img[@alt=‘The image alt text‘]
* xpath=//table[@id=‘table1‘]//tr[4]/td[2]
* xpath=//a[contains(@href‘#id1‘)]
* xpath=//a[contains(@href‘#id1‘)]/@class
* xpath=(//table[@class=‘stylee‘])//th[text()=‘theHeaderText‘]/../td
* xpath=//input[@name=‘name2‘ and @value=‘yes‘]
* xpath=//\*[text()=“right“]
* \ **link**\ =\ *textPattern*:
Se
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 12423416 2014-08-18 19:19 test\Firefox Setup 4.0.exe
文件 6651 2014-08-13 21:24 test\selenium\common\exceptions.py
文件 9671 2014-08-13 21:24 test\selenium\common\exceptions.pyc
文件 649 2014-08-13 21:24 test\selenium\common\__init__.py
文件 195 2014-08-13 21:24 test\selenium\common\__init__.pyc
文件 80696 2014-08-13 21:24 test\selenium\selenium.py
文件 95845 2014-08-13 21:24 test\selenium\selenium.pyc
文件 1561 2014-08-13 21:24 test\selenium\webdriver\android\webdriver.py
文件 1435 2014-08-13 21:24 test\selenium\webdriver\android\webdriver.pyc
文件 0 2014-08-13 21:24 test\selenium\webdriver\android\__init__.py
文件 155 2014-08-13 21:24 test\selenium\webdriver\android\__init__.pyc
文件 4439 2014-08-13 21:24 test\selenium\webdriver\chrome\options.py
文件 4872 2014-08-13 21:24 test\selenium\webdriver\chrome\options.pyc
文件 3676 2014-08-13 21:24 test\selenium\webdriver\chrome\service.py
文件 3555 2014-08-13 21:24 test\selenium\webdriver\chrome\service.pyc
文件 3050 2014-08-13 21:24 test\selenium\webdriver\chrome\webdriver.py
文件 2706 2014-08-13 21:24 test\selenium\webdriver\chrome\webdriver.pyc
文件 623 2014-08-13 21:24 test\selenium\webdriver\chrome\__init__.py
文件 154 2014-08-13 21:24 test\selenium\webdriver\chrome\__init__.pyc
文件 9762 2014-08-13 21:24 test\selenium\webdriver\common\action_chains.py
文件 13007 2014-08-13 21:24 test\selenium\webdriver\common\action_chains.pyc
文件 2320 2014-08-13 21:24 test\selenium\webdriver\common\alert.py
文件 2753 2014-08-13 21:24 test\selenium\webdriver\common\alert.pyc
文件 1111 2014-08-13 21:24 test\selenium\webdriver\common\by.py
文件 1044 2014-08-13 21:24 test\selenium\webdriver\common\by.pyc
文件 3196 2014-08-13 21:24 test\selenium\webdriver\common\desired_capabilities.py
文件 2264 2014-08-13 21:24 test\selenium\webdriver\common\desired_capabilities.pyc
文件 661 2014-08-13 21:24 test\selenium\webdriver\common\html5\application_cache.py
文件 1438 2014-08-13 21:24 test\selenium\webdriver\common\html5\application_cache.pyc
文件 623 2014-08-13 21:24 test\selenium\webdriver\common\html5\__init__.py
............此处省略110个文件信息
相关资源
- 3D打印机控制软件Cura源码
- 《机器学习实战》源代码Python3
- pygame之《飞机大战》
- python暴力破解蓝奏网盘密码.zip
- python外星人入侵.rar
- 用tkinter写的python GUI注册界面
- PythonTank
- SVD实现代码
- python爬取维基百科程序语言消息盒(
- easygui-0.96
- python坦克大战分步骤源码及素材
- django+mysql家具购物网站,包含部署教
- python新浪微博爬虫
- Python3.5.2的IDLE汉化版计算机等级考试
- 12306爬虫实现
- Python求解数独并输出求解过程
- python程序设计基础课件
- 西电python网络处理上机题答案
- VMD变分模态分解算法
- Python网络编程 3版 高清扫描版 完整中
- 使用python编写的打飞机游戏源码
- 计算24点python
- 扑克小游戏python代码
- Python黑客攻防入门.pdf
- 《Python语言程序设计基础第二版PDF+课
- Python-PySimpleGUI一个建立在tkinter之上简
- python3.5 百度ai人脸识别
- python编程从入门到实践的案例和动手
- 编译原理词法分析器、语法分析器p
- python3实现的国密SM2+SM3
评论
共有 条评论