Webdriver升级版。

webdriverplus的Python项目详细描述


在python中使用selenium的最简单和最强大的方法

webdriver plus是selenium webdriver的python绑定的扩展, 这为您提供了一个更简洁、更具表现力的api。

它帮助您快速编写可读、健壮的测试。

webdriver plus有什么了不起的?

    Browser在退出时支持池和自动退出。
  • 一个用于查找元素的简洁api,以及一系列选择器。
  • jquery风格的遍历和筛选,用于在不使用 复杂的xpath表达式。
  • 对元素执行操作而不必使用actionchains。
  • 元素突出显示使从python控制台工作成为一种乐趣。

注意:如果您有兴趣长期帮助维护webdriver plus,请与我们联系。作者的大部分开放源码时间目前都花在了django rest框架上。

开始

使用pip安装webdriverplus。

pip install webdriverplus

现在启动python控制台…

>>> from webdriverplus import WebDriver
>>> browser = WebDriver().get('http://www.google.com')

好的,我们来搜索一下。

>>> browser.find(name='q').send_keys('selenium\n')

现在让我们得到所有搜索结果的标题。

>>> browser.find(id='search').find('h3')
WebElementSet(
  <h3 class="r"><a href="http://seleniumhq.org/" class="l" onmousedown="retur...
  <h3 class="r"><a href="http://www.google.co.uk/url?sa=t&amp;rct=j&amp;q=sel...
  <h3 class="r"><a href="http://en.wikipedia.org/wiki/Selenium" class="l" onm...
  <h3 class="r"><a href="http://en.wikipedia.org/wiki/Selenium_%28software%29...
  <h3 class="r"><a href="http://ods.od.nih.gov/factsheets/selenium" class="l"...
  <h3 class="r"><a href="http://www.nlm.nih.gov/medlineplus/druginfo/natural/...
  <h3 class="r"><a href="http://www.hollandandbarrett.com/selenium-050" class...
  <h3 class="r"><a href="http://www.whfoods.com/genpage.php?dbid=95&amp;tname...
  <h3 class="r"><a href="http://www.patient.co.uk/doctor/Selenium.htm" class=...
  <h3 class="r"><a href="/search?q=selenium&amp;hl=en&amp;biw=940&amp;bih=938...
  <h3 class="r"><a href="http://www.umm.edu/altmed/articles/selenium-000325.h...
)

请注意,webdriver plus已经为您突出显示了选定的元素,其中 当你在写测试并试图确保你 选择正确的元素:

https://raw.github.com/tomchristie/webdriverplus/master/docs/screenshot.png

下一步

当您准备好开始时,请转到完整的文档(http://webdriver-plus.readthedocs.org/)。

如果您想帮助您为项目做贡献,请阅读贡献说明(http://webdriver-plus.readthedocs.org/en/latest/topics/contributing.html

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java将多个线程中的函数放入单个队列   数组在Java中,如何在不改变整数顺序的情况下找到整数组的顺序?   java控制器属于表示层?   java Apache Ivy和本地Maven repo如何处理使用Maven 3构建的快照   Java可与泛型类型进行比较   java这个表达式在泛型中是什么意思   JavaEclipse和TeamCity插件   java检测构造函数中的final是否为空   java如何在StanfordCoreNLP管道中同时使用词汇化和依赖性解析器?   java在AntUnit控制台日志中显示完整异常堆栈跟踪   lambda如何与Java 8供应商建立连锁关系   如何让GRPC的重试机制在Kubernetes集群中使用grpcjava工作?   如何使用openjdk:7 Docker映像和Gradle包装器避免“EC参数错误”?   java将集合映射扩展为一维映射新的“无法推断函数接口类型”