about Robot, learnt from the following document, perfect document !!!!

http://www.virtuousprogrammer.com/?s=robot

 
Test Automation with Robot Framework
 
Here's the content of the "SimpleTest.txt"
*** Settings ***
Library Selenium Library *** Testcases ***
Login Should Succeed When the Correct Username and Password are Entered
Start Selenium Server
Set Selenium Timeout 10
Open Browser file:///D:/robot/Login.htm ie
Sleep 3
Input Allentext uname AUser
Input Text pwd TestPass
Click Button login
Page Should Contain AUser
Close Browser
Stop Selenium Server

打开 Ride, 看到的如下:

所以你一定问, 这种浅蓝色的 low level keyword 到底是在哪里定义的?

比如 Start Selenium Server:

其实来源于:

*** Settings ***
Library Selenium Library

RIDE UI 上是:

可只是一句 "Library Selenium Library" 就可以了么?到底 Selenium Library 在哪里?

很简单: C:\Python27\Lib\site-packages

打开 __init__.py, 能够看到如下:

    def start_selenium_server(self, *params):
"""Starts the Selenium Server provided with SeleniumLibrary. `params` can contain additional command line options given to the
Selenium Server. This keyword uses some command line options
automatically: 1) The port given in `importing` is added to `params` automatically
using the `-port` option. 2) A custom Firefox profile that is included with the library
and contains automation friendly settings is enabled via the
`-firefoxProfileTemplate` option. You can override this
profile with your own custom profile by using the same argument
in `params` yourself. To use the default profile on your machine,
use this argument with `DEFAULT` value (case-sensitive). 3) Starting from SeleniumLibrary 2.6, if there is `user-extensions.js`
file in the same directory as Selenium Server jar, it is loaded using
the `-userExtensions` option. This is not done if the option is
defined in `params`. By default, such extension file providing Flex
testing support is loaded automatically. Special syntax `JVM=some jvm opts` can be used to define options to
the java command itself used to start the selenium server. This
possibility was added in SeleniumLibrary 2.9.1. Examples:
| Start Selenium Server | | | # Default settings. Uses the Firefox profile supplied with the library. |
| Start Selenium Server | -firefoxProfileTemplate | C:\\\\the\\\\path | # Uses custom Firefox profile. |
| Start Selenium Server | -firefoxProfileTemplate | DEFAULT | # Uses default Firefox profile on your machine. |
| Start Selenium Server | -avoidProxy | -ensureCleanSession | # Uses various Selenium Server settings. |
| Start Selenium Server | -JVM=-DserverName=somehost | # Define JVM options. | All Selenium Server output is written into `selenium_server_log.txt`
file in the same directory as the Robot Framework log file. If the test execution round starts and stops Selenium Server multiple
times, it is best to open the server to different port each time. *NOTE:* This keyword requires `subprocess` module which is available
on Python/Jython 2.5 or newer.
"""
params = ('-port', str(self._server_port)) + params
logpath = os.path.join(self._get_log_dir(), 'selenium_server_log.txt')
self._selenium_log = open(logpath, 'w')
start_selenium_server(self._selenium_log, self._jar_path, *params)
self._html('Selenium server log is written to <a href="file://%s">%s</a>.'
% (logpath.replace('\\', '/'), logpath))

这就是 start selenium server 的最源头。

我们也可以把整个 C:\Python27\Lib\site-packages\SeleniumLibrary 文件夹复制一份并且重命名为 "AllenLibrary", 然后打开  __init__.py, 把其中所有的 "SeleniumLibrary" 替换成 "AllenLibrary".

这时就可以直接使用 AllenLibrary了。

看,上面就是 Allen Library 的情况。

我们可以使用多个 library。

*** Settings ***
Library Selenium Library
Library Allen Library *** Test Cases ***
testcase1
AllenLibrary.Start Selenium Server
AllenLibrary.Set Selenium Timeout 10
SeleniumLibrary.Open Browser file:///D:/robot/Login.htm ie
Sleep 3
SeleniumLibrary.Input Allentext uname AUser
SeleniumLibrary.Input Text pwd TestPass
Comment AllenLibrary.Input Allen2text uname BUser
sleep 3
AllenLibrary.Click Button login
AllenLibrary.Page Should Contain AUser
AllenLibrary.Close Browser
AllenLibrary.Stop Selenium Server

只是之后使用的时候要表明清楚所用的方法是从 AllenLibrary来的,还是从 SeleniumLibrary来的。

 

Robot Framework 1的更多相关文章

  1. Robot Framework用户手册 (版本:3.0)

    版权信息:诺基亚网络和解决中心 本翻译尊重原协议,仅用于个人学习使用 1.开始: 1.1 介绍: Robot Framework是一个基于Python的,为终端测试和验收驱动开发(ATDD)的可扩展的 ...

  2. RIDE -- Robot Framework setup

    RobotFramework 是一款基于python 的可以实现关键字驱动和数据驱动并能够生成比较漂亮的测试报告的一款测试框架 这里使用的环境是 python-2.7.10.amd64.msi RID ...

  3. Robot Framework自动化测试 ---视频与教程免费分享

    当我第一次使用Robot Framework时,我是拒绝的.我跟老大说,我拒绝其实对于习惯了代码的自由,所以讨厌这种“填表格”式的脚本.老大说,Robot Framework使用简单,类库丰富,还可以 ...

  4. Robot Framework 的安装和配置(转载)

    Robot Framework 的安装和配置 在使用 RF(Rebot framework)的时候需要 Python 或 Jython 环境,具体可根据自己的需求来确定.本文以在有 Python 的环 ...

  5. 解决从jenkins打开robot framework报告会提示‘Opening Robot Framework log failed ’的问题

    最新的jenkins打开jenkins robot framework报告会提示如下 Verify that you have JavaScript enabled in your browser.  ...

  6. 在centos7中安装Robot Framework

    安装前景介绍: 最初,我们是在Windows环境下搭建Robot Framework来对我们的服务进行接口测试的(想知道如何在Windows下安装Robot Framework,可以参考我同事的博客h ...

  7. 移动端自动化环境搭建-Robot Framework的安装

    A.安装依赖 RF框架,robotframework本身. B.安装过程 可以通过下载 exe 程序进行安装,Robot Framework 分别提供了,win-amd64.exe 和 win32.e ...

  8. robot framework 安装配置

    robot framework 是一款专门用作自动化测试的框架,提供了丰富的内置库,与第三方库,也支持用户自己编写的库,robot framework +library 可以 用来做ui的自动化测试, ...

  9. Robot Framework入门学习1 安装部署详解

    安装注意: 目前Robot framework-ride不支持python3,安装时请下载python2.7版本. Robot Framework安装时出现了一点小问题,网上没有找到直接的介绍,现将安 ...

  10. Robot Framework自动化测试(七)--- jybot模式

    虽然,很久不用关于Robot Framework框架了,但我这里应该是除了@齐涛-道长之外分享Robot Framework 相关资料比较多的地方了.所以,常常被问到一些关于该框架的问题. 虽然,我一 ...

随机推荐

  1. 《java与模式》

    2012年3月 随笔档案 - java_my_life - 博客园--此网友 12年的博客都是和模式有关的,希望可以多看看.http://www.cnblogs.com/java-my-life/ar ...

  2. 计算机视觉学习记录 - Implementing a Neural Network from Scratch - An Introduction

    0 - 学习目标 我们将实现一个简单的3层神经网络,我们不会仔细推到所需要的数学公式,但我们会给出我们这样做的直观解释.注意,此次代码并不能达到非常好的效果,可以自己进一步调整或者完成课后练习来进行改 ...

  3. 1120 机器人走方格 V3(组合数)

    题目实际上是求catalan数的,Catalan[n] = C(2*n,n) / (n+1) = C(2*n,n) % mod * inv[n+1],inv[n+1]为n+1的逆元,根据费马小定理,可 ...

  4. JVM的垃圾回收机制 总结(垃圾收集、回收算法、垃圾回收器)

     相信和小编一样的程序猿们在日常工作或面试当中经常会遇到JVM的垃圾回收问题,有没有在夜深人静的时候详细捋一捋JVM垃圾回收机制中的知识点呢?没时间捋也没关系,因为小编接下来会给你捋一捋. 一. 技术 ...

  5. xheditor编辑器上传图片

    之前在用csdn的时候,觉得他们家的编辑器挺好用,精美,简洁,大方,功能强大.最近自己的项目也要用到编辑器,我就想起了xheditor. 好多大网站都用到它~好棒! 我把xheditor用于文章模块, ...

  6. Lua与C

    [前言] 对于Lua的基础总结总算告一段落了,从这篇博文开始,我们才真正的进入Lua的世界,一个无聊而又有趣的世界.来吧. Lua语言是一种嵌入式语言,它本身的威力有限:当Lua遇见了C,那它就展示了 ...

  7. 【原创】大数据基础之Flink(1)简介、安装、使用

    Flink 1.7 官方:https://flink.apache.org/ 一 简介 Apache Flink is an open source platform for distributed ...

  8. 【原创】大叔经验分享(17)编程实践对比Java vs Scala

    scala 官方地址 https://www.scala-lang.org/ 本文尽可能包含了一些主要的java和scala在编程实践时的显著差异,展现scala的代码的简洁优雅:scala通吃< ...

  9. Java框架之spring框架的优点,为什么要学习spring框架

    为什么要学习Spring的框架a: 方便解耦,简化开发    Spring就是一个大工厂,可以将所有对象创建和依赖关系维护,交给Spring管理 b:AOP编程的支持      Spring提供面向切 ...

  10. Scala数组| 集合

    arrays :+ 5尾部   头部5 +: arrays TODO 声明不可变数组,不能删; 默认情况下,scala中集合的声明全都是不可变的 val arrays: Array[Int] = Ar ...