Selenium + python's automated framework Building

Source: Internet
Author: User

Selenium is a Web -based automated testing tool that, compared to other automation tools, is the most important feature of cross-platform, cross-browser.
Supports Windows, Linux, MAC, ie, FF, Safari, Opera, Chrome, and more.
There is also a feature that supports the execution of distributed test Cases , which distributes test cases to the execution of different test machines, equivalent to the functions of a dispenser.

The principles, architecture, and use of selenium can be consulted on their official website, where a selenium test case development environment using python is documented. In fact with Python
There are 2 ways to develop selenium: one is to go to selenium official website to download the Python version of the selenium engine, there is no operation, here is not listed, interested friends can self-access information


Here is the first form of construction:

1. Install python2.7x32 or x64 version

2. Install the PIP tool
3. Install selenium directly with PIP, command: Pip install-u Selenium

If the test succeeds, you'll see Google Search after you open your browser. In addition selenium sub-version 1 and version 2, where the installation is version 2 of the selenium. 650) this.width=650; "src=" Https://code.csdn.net/assets/ico_fork.svg "alt=" derived to My Code slice "width=" "height=" "/>"

#-*-coding:utf-8-*-    from selenium import webdriver  from  selenium.common.exceptions import timeoutexception  from  selenium.webdriver.support.ui import webdriverwait # available since 2.4.0   import time    # create a new instance of the  browser driver  driver = webdriver. Chrome ()   # #可以替换为IE (),  firefox (), but only if the browser is configured driver, Firefox in my own use if browsers and drivers are not compatible, the browser in the start and exit is reported to stop working, here note     # go to the google home page  driver.get ("http ://www.google.com ")     # find the element that ' s name  attribute is q  (The google search box)   inputElement =  Driver.find_element_by_name ("q")     # type in the search&Nbsp; inputelement.send_keys ("cheese!")     # submit the form.  (although google automatically  searches now without submitting)   inputelement.submit ()     #  the page is ajaxy so the title is originally this:   print driver.title    try:      # we  have to wait for the page to refresh, the last thing  that seems to be updated is the title       Webdriverwait (DRIVER, 10). Until (Lambda driver : driver.title.lower (). StartsWith ("cheese!"))         # You should see  "cheese! -  Google search "      print driver.title  &nbsP; finally:      driver.quit ()     #==================== ==============


This article is from the "ganshizhe.bokee.com" blog, make sure to keep this source http://328538.blog.51cto.com/318538/1660371

Selenium + python's automated framework Building

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.