Robot Framework 1

Source: Internet
Author: User

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

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

Test Automation with Robot FrameworkHere's the content of the "SimpleTest.txt"
Settings ***library       Selenium library*** testcases ***login should succeed when the Correct Username and Password a Re entered  Start Selenium Server  Set Selenium Timeout  ten  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

Open the Ride and see the following:

So you must ask, where exactly is this light blue level keyword defined?

For example, Start Selenium Server:

Actually comes from:

Settings ***library       Selenium Library

The RIDE UI is:

Can it be just a "library Selenium library"? Where the hell is the Selenium Library?

Very simple: C:\Python27\Lib\site-packages

To open __init__.py, you can see the following:

    defStart_selenium_server (Self, *params):"""Starts the Selenium Server provided with Seleniumlibrary. The ' 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 ' are added to ' par        AMS ' automatically using the '-port ' option. 2) A Custom Firefox profile which 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 profiles by using the same argument in ' params ' yourself.        To use the default profiles on your machine, use this argument with ' default ' value (case-sensitive). 3) starting from Seleniumlibrary 2.6, if there was ' user-extensions.js ' file in the same directory as Selenium Serve  R jar, it is loaded using the '-userextensions ' option.  This was not done if the option was 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 Selen Ium server.        This possibility is 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 to ' selenium_server_log.txt ' file in the same directory as the Robot Framew        Ork log file. If THe test execution round starts and stops Selenium server multiple times, it's best to open the server to different        Port each time.         *note:* this keyword requires ' subprocess ' module which are 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))

This is the source of the start selenium server.

We can also copy the entire C:\Python27\Lib\site-packages\SeleniumLibrary folder and rename it to "Allenlibrary", then turn on __init__.py and put all of the " Seleniumlibrary "replaced with" Allenlibrary ".

Then you can use the allenlibrary directly.

Look, this is the case with the Allen Library.

We can use more than one library.

Settings ***library           Selenium librarylibrary           Allen library*** Test Cases ***testcase1    allenlibrary . Start Selenium Server    allenlibrary. Set Selenium Timeout    ten    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

Just use it later to make it clear that the method used is from Allenlibrary, or from Seleniumlibrary.

Robot Framework 1

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.