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