Python+selenium+robot

Source: Internet
Author: User

Preparatory work:

1. Download python2.7

http://python.org/getit/

2. Download Download Setuptools "Python's Basic Package tool"

can help us easily download, build, install, upgrade, uninstall Python
The package.

Http://pypi.python.org/pypi/setuptools

3. Download Pip "Python's installation package management tool"

With this tool, we just need a command to easily install any class library in Python.

Https://pypi.python.org/pypi/pip

4. Decompression and cmd command-line installation

Setuptools-1.3.2.tar.gz Decompression

Pip-1.4.1.tar.gz Decompression

CMD command line:

C:\setuptools-1.3>python ez_install.py

C:\pip-1.4.1 > Python setup.py install

C:\Python27\Scripts > Easy_install pip

C:\Python27\Scripts > Pip install-u Selenium

5. Start writing Python+selenium automation scripts

# coding = Utf-8from Selenium Import webdriverbrowser = Webdriver. Firefox () browser.get ("http://www.baidu.com") browser.find_element_by_id ("kw"). Send_keys ("Selenium") browser.find _element_by_id ("su"). Click () browser.quit ()

  

After the input completes the command for baidu.py Save, runs the script, will see the script launches the Firefox browser to enter the Baidu page,
Enter "Selenium" to click the Search button and finally close the browser process. (The default reader here already has the Firefox browser installed)

The above is a simple python+selenium build next to the robot frame

6. Installing robot

: https://pypi.python.org/pypi/robotframework/2.8.7

CMD command-line installation: C:\python27\lib\site-packages>pip install Robotframwork

7. Install Wxpython:

: http://www.wxpython.org/download.php

WxPython is a very well-known GUI library for Python because ride was developed based on this library, so this must be installed.
Find the appropriate version on the official web download, exe executable file, double-click the button.

8. Installing Ride

: Https://pypi.python.org/pypi/robotframework-ride

RIDE is the editor for the robot Framework test data. It enables the organization of test case creation, run, and test projects to be
Finish in the form interface

CMD command-line installation: C:\robot\robotframework-ride-1.3>python setup.py Install

9. Create a test project

File----->new Project

Name Enter the project name, type Select Directory

Format Select Robot

10. Create a test suite

Right-click on "Test Project" and tap new Suite

Name enter project names

Type Select File

Format Selection txt

11. Create Test Cases

Right-click on "Test Project" to new TestCase

Enter case name

12. Loading the Selenium2library library

13. Enter the appropriate keywords

14. Click Start to run the test case to view the report

Python+selenium+robot

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.