资源简介
自己网页自动化测试使用。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个文件信息
相关资源
- Instant Pygame for Python Game Development How
- Biopython Tutorial
- Think Python 2nd
- 一个小小的表白程序(python)
- Python课堂笔记(高淇400集第一季)
- 二级考试python试题12套(包括选择题和
- pywin32_python3.6_64位
- python+ selenium教程
- PycURL(Windows7/Win32)Python2.7安装包 P
- 英文原版-Scientific Computing with Python
- 7.图像风格迁移 基于深度学习 pyt
- 基于Python的学生管理系统
- A Byte of Python(简明Python教程)(第
- Python实例174946
- Python 人脸识别
- Python 人事管理系统
- 基于python-flask的个人博客系统
- 计算机视觉应用开发流程
- python 调用sftp断点续传文件
- python socket游戏
- 基于Python爬虫爬取天气预报信息
- python函数编程和讲解
- Python开发的个人博客
- 基于python的三层神经网络模型搭建
- python实现自动操作windows应用
- python人脸识别(opencv)
- python 绘图(方形、线条、圆形)
- python疫情卡UN管控
- python 连连看小游戏源码
- 基于PyQt5的视频播放器设计
评论
共有 条评论