"""
Copyright 2006 ThoughtWorks, Inc.
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.
"""
__docformat__ = "restructuredtext en"
# This file has been automatically generated via XSL
import httplib
import urllib
import re
class selenium:
"""
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*:
Select the link (anchor) element which contains text matching the
specified \ *pattern*.
* link=The link text
* \ **css**\ =\ *cssSelectorSyntax*:
Select the element using css selectors. Please refer to CSS2 selectors, CSS3 selectors for more information. You can also check the TestCssLocators test in the selenium test suite for an example of usage, which is included in the downloaded selenium core package.
* css=a[href="#id3"]
* css=span#firstChild + span
Currently the css selector locator supports all css1, css2 and css3 selectors except namespace in css3, some pseudo classes(:nth-of-type, :nth-last-of-type, :first-of-type, :last-of-type, :only-of-type, :visited, :hover, :active, :focus, :indeterminate) and pseudo elements(::first-line, ::first-letter, ::selection, ::before, ::after).
* \ **ui**\ =\ *uiSpecifierString*:
Locate an element by resolving the UI specifier string to another locator, and evaluating it. See the Selenium UI-Element Reference for more details.
* ui=loginPages::loginButton()
* ui=settingsPages::toggle(label=Hide Email)
* ui=forumPages::postBody(index=2)//a[2]
Without an explicit locator prefix, Selenium uses the following default
strategies:
* \ **dom**\ , for locators starting with "document."
* \ **xpath**\ , for locators starting with "//"
* \ **identifier**\ , otherwise
Element Filters
~~~~~~~~~~~~~~~
Element filters can be used with a locator to refine a list of candidate elements. They are currently used only in the 'name' element-locator.
Filters look much like locators, ie.
\ *filterType*\ **=**\ \ *argument*
Supported element-filters are:
\ **value=**\ \ *valuePattern*
Matches elements based on their values. This is particularly useful for refining a list of similarly-named toggle-buttons.
\ **index=**\ \ *index*
Selects a single element based on its position in the list (offset from zero).
String-match Patterns
~~~~~~~~~~~~~~~~~~~~~
Various Pattern syntaxes are available for matching string values:
* \ **glob:**\ \ *pattern*:
Match a string against a "glob" (aka "wildmat") pattern. "Glob" is a
kind of limited regular-expression syntax typically used in command-line
shells. In a glob pattern, "\*" represents any sequence of characters, and "?"
represents any single character. Glob patterns match against the entire
string.
* \ **regexp:**\ \ *regexp*:
Match a string using a regular-expression. The full power of JavaScript
regular-expressions is available.
* \ **regexpi:**\ \ *regexpi*:
Match a string using a case-insensitive regular-expression.
* \ **exact:**\ \ *string*:
Match a string exactly, verbatim, without any of that fancy wildcard
stuff.
If no pattern prefix is specified, Selenium assumes that it's a "glob"
pattern.
For commands that return multiple values (such as verifySelectOptions),
the string being matched is a comma-separated list of the return values,
where both commas and backslashes in the values are backslash-escaped.
When providing a pattern, the optional matching syntax (i.e. glob,
regexp, etc.) is specified once, as usual, at the beginning of the
pattern.
"""
### This part is hard-coded in the XSL
def __init__(self, host, port, browserStartCommand, browserURL):
self.host = host
self.port = port
self.browserStartCommand = browserStartCommand
self.browserURL = browserURL
self.sessionId = None
self.extensionJs = ""
def setExtensionJs(self, extensionJs):
self.extensionJs = extensionJs
def start(self):
result = self.get_string("getNewBrowserSession", [self.browserStartCommand, self.browserURL, self.extensionJs])
try:
self.sessionId = result
except ValueError:
raise Exception, result
def stop(self):
self.do_command("testComplete", [])
self.sessionId = None
def do_command(self, verb, args):
conn = httplib.HTTPConnection(self.host, self.port)
body = u'cmd=' + urllib.quote_plus(unicode(verb).encode('utf-8'))
for i in range(len(args)):
body += '&' + unicode(i+1) + '=' + urllib.quote_plus(unicode(args[i]).encode('utf-8'))
if (None != self.sessionId):
body += "&sessionId=" + unicode(self.sessionId)
headers = {"Content-Type": "application/x-www-form-urlencoded; charset=utf-8"}
conn.request("POST", "/selenium-server/driver/", body, headers)
response = conn.getresponse()
#print response.status, response.reason
data = unicode(response.read(), "UTF-8")
result = response.reason
#print "Se
没有合适的资源?快使用搜索试试~ 我知道了~
selenium rc
共1157个文件
html:917个
dll:79个
xml:27个
5星 · 超过95%的资源 需积分: 50 5.3k 下载量 143 浏览量
2010-09-14
23:50:07
上传
评论 88
收藏 19.98MB RAR 举报
温馨提示
在公司只有有限的网站可以上,其它屏蔽了,自己中传下,回公司安装.需要的朋友可以去官网下载 -- 很少专门上CSDN,今天发现终于可以修改下载积分了。这个资源本来是N年前自己弄来准备放公司内网安装学习的,所以就随便填了50积分,结果发现直到最近竟然还有用户来下载,但之前所需要的下载积分一直不能修改;对不起之前下载的朋友了。。。
资源推荐
资源详情
资源评论
收起资源包目录
selenium rc (1157个子文件)
solution.build 2KB
GenerateNAntSchema.build 392B
cybervillainsCA.cer 665B
Changes 6KB
NAnt.exe.config 47KB
nunit-gui.exe.config 3KB
nunit-console.exe.config 3KB
nunit.tests.dll.config 3KB
mock-assembly.dll.config 2KB
DefaultSelenium.cs 90KB
ISelenium.cs 73KB
HttpCommandProcessor.cs 11KB
DefaultSeleniumTest.cs 4KB
ICommandProcessor.cs 4KB
DefaultRemoteCommand.cs 3KB
DefaultSelenesCommandTest.cs 2KB
I18nTest.cs 2KB
SeleniumIntegrationTest.cs 2KB
GoogleTest.cs 1KB
SeleniumException.cs 1KB
IRemoteCommand.cs 862B
CommonAssemblyInfo.cs 656B
AssemblyInfo.cs 360B
AssemblyInfo.cs 359B
AssemblyInfo.cs 352B
IntegrationTests.csproj 5KB
Core.csproj 5KB
UnitTests.csproj 5KB
MSDN.css 8KB
epydoc.css 8KB
stylesheet.css 5KB
rdoc-style.css 4KB
stylesheet.css 1KB
stylesheet.css 1KB
tree.css 1KB
banner.css 393B
Thumbs.db 3KB
NDoc.Documenter.NativeHtmlHelp2.dll 448KB
NDoc.Documenter.Msdn2.dll 432KB
NAnt.Core.dll 344KB
NDoc.Documenter.Msdn.dll 324KB
NDoc.Documenter.Msdn.dll 324KB
NDoc.Documenter.Msdn.dll 324KB
NDoc.Documenter.Msdn.dll 324KB
NDoc.Documenter.Msdn.dll 311KB
NDoc.Documenter.Msdn.dll 311KB
NDoc.Documenter.LinearHtml.dll 260KB
NDoc.Core.dll 204KB
NDoc.Core.dll 204KB
NDoc.Core.dll 204KB
NDoc.Core.dll 204KB
log4net.dll 200KB
nunit.tests.dll 184KB
NDoc.Core.dll 171KB
NDoc.Core.dll 171KB
ICSharpCode.SharpCvsLib.dll 148KB
nunit.uikit.dll 140KB
NAnt.VSNetTasks.dll 132KB
NDoc.Documenter.NAnt.dll 128KB
ICSharpCode.SharpZipLib.dll 124KB
NAnt.DotNetTasks.dll 104KB
ICSharpCode.SharpCvsLib.Console.dll 96KB
nunit.util.dll 84KB
nunit.util.dll 84KB
nunit.util.dll 84KB
nunit.util.dll 80KB
NDoc.Documenter.JavaDoc.dll 76KB
nunit.core.dll 60KB
nunit.core.dll 60KB
nunit.core.dll 60KB
nunit.core.dll 60KB
nunit.core.dll 60KB
nunit.core.dll 60KB
nunit.util.dll 57KB
nunit.util.dll 57KB
NDoc.Test.dll 48KB
nmock.dll 48KB
nmock.dll 48KB
nunit.core.dll 45KB
nunit.core.dll 45KB
NAnt.SourceControlTasks.dll 40KB
NUnitCore.dll 40KB
ThoughtWorks.Selenium.Core.dll 40KB
NAnt.VisualCppTasks.dll 36KB
NAnt.NUnit1Tasks.dll 36KB
NDoc.Documenter.Latex.dll 36KB
NAnt.CompressionTasks.dll 32KB
NAnt.NUnit2Tasks.dll 32KB
nunit.framework.dll 28KB
NAnt.Win32Tasks.dll 28KB
NDoc.ExtendedUI.dll 28KB
nunit.framework.dll 28KB
NDoc.ExtendedUI.dll 28KB
nunit.framework.dll 28KB
NDoc.ExtendedUI.dll 28KB
nunit.framework.dll 28KB
NDoc.ExtendedUI.dll 28KB
nunit.framework.dll 28KB
nunit.framework.dll 28KB
nunit.mocks.dll 20KB
共 1157 条
- 1
- 2
- 3
- 4
- 5
- 6
- 12
fanxinyuan
- 粉丝: 7
- 资源: 5
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
- 3
- 4
- 5
- 6
前往页