Robotframework+selenium2library installation steps and simple use
Environment Installation
Batch Installation test environment
step1: Download "Environment installation folder"
https://github.com/yuhuixu/robotframework-web-
Step2: Double-click Run "Environment install –exe install. bat"
The batch will be installed automatically, but the lack of the next step cannot be automated, with subsequent improvements
Remember to check x64 when installing "Autoit-v3-setup.exe"
Python-2.7.13.amd64.msi
Pycrypto-2.6.win-amd64-py2.7.exe
Vcforpython27.msi
Wxpython2.8-win64-unicode-2.8.12.1-py27.exe
Pywin32
Autoit-v3-setup.exe
step3: Double-click Run "Environment Install –python Library. Bat"
There is no need to manually place, if the error please send me a screenshot, thank you
Xyh421@qq.com
Install the test environment manually
Download the Environment installation folder to a local
https://github.com/yuhuixu/robotframework-web-
Installing python2.7
Step 1: Current directory Python installation package (win-64 bit)
Python-2.7.13.amd64.msi
Step 2: Double-click Install, all default settings
Step 3: Installation complete, display the Python27 folder in the C drive, as shown in the figure
Step 4: Setup
C:\python27 to System environment variables
install Pip (i.e. C:\Python27\Scripts\pip.exe)
Step 1:cmd command line into the current directory pip-9.0.1 folder path (E: \ Environment installation folder \pip-9.0.1)
CD E: \ Environment installation Folder \pip-9.0.1\
Step 2: Under Directory, execute Python setup.py install in command line mode
Command.
Step 3: Check if the script folder appears in the Python27 directory, as shown in the figure
Step 5: Add c:\python27\scripts and c:\python27 to environment variables, as shown in the following figure
Put the path c:\python27\scripts;c:\python27 into the system environment variable
Step 6: Install PIP
Run Easy_install pip in cmd
Check if the installation was successful: PIP-V (note the uppercase V)
Check what packages are installed
Pip list, which you can follow to check what packages have been installed, and the version of the package.
Installing WxPython
Step 1: Find Wxpython2.8-win64-unicode-2.8.12.1-py27.exe from the Environment installation package
Step 2: Double click to execute
Step 3: Check if the installation is successful
Enter python on the cmd command line and enter import WX, without error, as shown in the following figure
Installing Pycrypto
Step 1: Find Pycrypto-2.6.win-amd64-py2.7.exe from the Environment installation package
Step 2: Double click to execute
Step 3: Check if the installation is successful
Enter python on the cmd command line and enter import Crypto without error.
Installing Vcforpython27.msi
Step 1: Find Vcforpython27.msi from the Environment installation package
Step 2: Double click to execute, click Next
Step 3: Installation without error, and other not reported similar to the following errors
Error:unable to find Vcvarsall.bat
Installing Pywin32
Step 1: Find Pywin32-220.win-amd64-py2.7.exe from the Environment installation package
Step 2: Double click to execute
Step 3: No error during installation
Note: Used to resolve the import Pywin32 related module report could not find the relevant module issues
Installing Autoit-v3-setup.exe
Step 1: Find Autoit-v3-setup.exe from the Environment installation package
Step 2: Double-click Execution, remember to select 64 bits (consistent with your python64 bit)
Step 3: The installation process is not an error, if there is rogue antivirus software error, please join the white list.
Installing AutoItLibrary-1.1
Request here, CMD opens as Administrator
Cd to AutoItLibrary-1.1 directory, execute python setup.py install in cmd
Installing Robotframework
Execute command in cmd pip install Robotframework
Installing Robotframework-ride
In cmd, execute the command pip install Robotframework-ride
Install Library
Selenium2library (for web testing)
Perform pip install robotframework-selenium2library in cmd
Ibid., Setup tables and database support libraries
Pip Install Robotframework-excellibrary
Pip Install Pymysql
Pip Install Robotframework-databaselibrary
Appiumlibrary
This is not a detailed description (for mobile testing, including Android and Ios,appium easy-to-use method robot Framework +appium Simple tutorial and examples)
Set Chromedriver
Step 1: Get the chrome version
Open Control Panel-programs and features
Find Chrome and view the version, like mine is version 52
Step 2: Find the Chromedriver version of the corresponding version
Open the link selenium chromedriver with the Chrome version mapping table and find the Chromedriver version of 2.24
Step 3: Download Chromedriver
Open the link http://chromedriver.storage.googleapis.com/index.html and go to the 2.24 folder, select Chromedriver_win32.zip to download and unzip. As shown in the following illustration:
Step 4: Add the Chromedriver folder to the system variable path
Navigate to the desktop, right-click My Computer-"Select Properties-" Select Advanced system Settings-"Select environment variables
Unzip the downloaded Chromedriver_win32.zip compressed package, the path, such as "E:\DRIVER\CHROMEDRIVER_WIN32;" Put it in the system variable path, or put it directly under the C:\python27″ directory.
Step 5: Verify that Chromedriver is added to the environment variable
Re-open cmd command line input Chromedriver
Set Firefoxdriver
TBD
Https://github.com/mozilla/geckodriver/releases
RIDE Use Guide Documentation
http://robotframework.org/robotframework/#user-guide Open Ride
After the installation succeeds, execute the command ride.py in the cmd command, as shown in Figure 1
Figure 1. Command line Start ride
After opening, you can create a test project, create a test case, and so on, with specific steps in the following example.
As shown in Figure 2.
Figure 2.RIDE Editor Launcher interface
To create a test project
Select Menu Bar File->new Project
Name Enter the project name test and select type for directory.
Figure 3. To create a test project
Create a test suite
Right-click on the test project you just created, select New Suit,
Name Input testsuit, type select File.
Figure 4. Create a test suite
Creating test Cases
Right-click on the test suite you just created, select New TestCase,
Name Type TestCase.
Figure 5. Creating test Cases
Import Library
STEP1: Click on the right side of the page, enter Selenium2library, then click the OK button
Figure 6. Import a test library
STEP2: Verify that the addition of the library succeeds, as shown in the figure Selenium2library Black is the success, if the display is red that is the failure
Writing code
Open Browser https:\\www.baidu.com browser=chrome
Figure 7: Writing code
Save Project
Shortcut key: Ctrl+shift+s (Save the whole project), Ctrl+s (local save, only save the mouse click on the part)
Run Tests
Click on Run tab, tick TestCase, select Pybot by default, click Run Test button
Figure 8: Run the test
View Results
Wait for the test to finish, you can see the test results on the main page, or at the top of the page, click to view the report and log details, as shown in the figure
Test log (shortcut key ctrl+l)
Test report (shortcut key Ctrl+r)
Query API
For example, query how the open browser method is used
Press F5 to bring up the Search Keyword window, enter open,source select Selenium2library
You can also go to SVN to view the Selenium2library API file
svn://xxxx/Automation Code/webtest/setup_doc/selenium2library Reference api.html
Figure 9. Query API
SVN code Run
Download Script
Download the script folder from SVN webtest
SVN://XXXX Automation Code/webtest
Ride Run
Step 1: Open the script folder from ride
In Ride, click file-"Open Directory, select the downloaded webtest folder
After the opening is complete as shown in the figure (see Webtest\readme.txt for a detailed description of the code)
Step 2: Run TestCase
Uncheck to prevent accidental check of other case, right click WebTest folder, select Deselect All Tests
Tick test case, run, and view results
FAQ
Do not modify the display scale of the browser, easy to cause UI operation error
Browser version is too low error message:
WebDriverException:Message:unknown Error:chrome version must be >= 31.0.1650.59
From unknown error:version info doesn ' t include string ' Browser '
(Driver info:chromedriver=2.9.248315,platform=windows NT 5.1 SP3 x86)
Workaround: Re-download the corresponding browser driver chromedriver browser driver variable add error message:
Webdriverexception:message: ' chromedriver ' executable needs to is in PATH.
Workaround: Set the Chromedriver path to the environment variable path to URL fill in error
{"Code": -32603, "message": "Cannot navigate to invalid URL"}
Www.baidu.com modified to https://www.baidu.com import collections and other local libraries failed
Prompt for log information
20161229 17:11:07.369 [WARN]: Importing Test Library "collections" failed
Traceback (most recent):
Importing test Library ' collections ' Failed:ImportError:cannot import name is_string
Workaround: Reinstall the Robotframework-ride first, if not resolved, re-install Robotframework prompt option–monitorcolors not recognized
Also Rice has met, to be determined
Unable to find Vcvarsall.bat
Workaround: Install Vcforpython27.msi
Reference documents
robotframework-Home
Robotframework-user Guide
Selenium2library (GitHub)