Selenium+python+pycharm for automated testing

Source: Internet
Author: User

Recent research on new automated testing methods, QTP has been used more skilled, to develop a new method, here to do a record and encourage everyone.

1, the first must be the configuration environment, step by step, first download the necessary tools:

Download a Python environment, I use the Python3.4 here, I will upload it, you can download directly. It is best to use 3.4 and above, so you can install the selenium directly without the PIP alone.

After the installation of Python can be online selenium installation, first cmd into the Python Scripts directory, the general is this: CD C:\Python34\Scripts

Then install the command online: C:\python34\scripts>pip install-u Selenium

Put a picture to see:

This is the basic environment, that's all. Next to download Iedriver, because most still want to run on IE, but selenium default is Firefox, so you want to download a iedriver (this I will upload), and then put in the directory of IE can be. It's so simple. Such as

Now you can configure the development IDE, I use Pycharm, this I also upload up. Check out my installed:

Development environment is OK, now it can be normal use, I used the

Webdriver. Ie()

In fact, you may not succeed, because I made a change, here (first hold the CTR, then the left mouse button that ie, go to the following page), here is the initialization of iedriver, give a path just.

__init__ (self, executable_path=' C:\Program files\internet Explorer\iedriverserver.exe ', Capabilities=None,

I'll post the code here:

 fromSeleniumImportWebdriverbrowser= Webdriver. Ie()Browser.get("Http://www.baidu.com")browser.find_element_by_id("KW"). Send_keys("Eric_guodongliang")browser.find_element_by_id("Su"). Submit()

After the run it looks like this:

You can start using Python to design your automation use case, and the next thing to do is to develop an automated framework that does not have the tools to drive without frames.

The next time to start the development of the framework, and eventually combined with the Python+selenium, the automation is completed.

Hope can help everyone.

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Selenium+python+pycharm for automated testing

Related Article

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.