Selenium Tutorial Day 6-1
Download
Report
Transcript Selenium Tutorial Day 6-1
Portnov Computer School
Test Automation For Web-Based Applications
Presenter:
Ellie Skobel
Day 6
Configuring Selenium
With PyCharm
2
Intelligent Code Editor
◦ Syntax highlighting
◦ Auto-Indentation
◦ Code completion
Easy Code Navigation & Search
◦ Go to Declaration
◦ Find Usages
Code Inspection
Python Refactoring
◦ On-the-fly error highlighting
◦ Quick-fixes
◦ Perform global code changes
3
Ensure Java is installed
◦ version 1.6 or later is advised
Install Python
◦ version 2.7 is what we will use in this class
Add Python and Java to your system $PATH
variable
Download and install PyCharm
https://www.jetbrains.com/pycharm/download/
4
Launch PyCharm.
Select File > New Project
Enter Project name and desired location
Select a Python Interpreter
5
Open cmd (or Terminal)
Ensure python is installed and has been
added to System PATH variable
◦ You should be able to type python in cmd and see
the following:
Python 2.7.3 (default, Apr 10 2012, 22.71:26) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
Install Selenium Client
In cmd type:
pip install selenium
If pip is not installed on your
system, you can easily install
it by running:
python get-pip.py
6
Open Selenium IDE
Open any test case
(for example ValidLogin.html)
Select File > Export Test Case As >
Python 2 / unittest / WebDriver
7
Select the Python Project you created
◦ You may optionally want to create a ‘tests’ subfolder for
better organization
Enter a name for the Python file with the file
extension .py
Click Save
8
Open any existing unittest TestCase
Right-click anywhere in the document
Select Run
Select Run
9