Test Automation For Web-Based Applications Portnov Computer School Presenter: Ellie Skobel
2 Day 6 Configuring Selenium With PyCharm
Intelligent Code Editor ◦ Syntax highlighting ◦ Auto-Indentation ◦ Code completion Easy Code Navigation & Search ◦ Go to Declaration ◦ Find Usages Code Inspection ◦ On-the-fly error highlighting ◦ Quick-fixes Python Refactoring ◦ 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 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 (default, Apr , 22.71:26) [MSC v bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> Install Selenium Client In cmd type: pip install selenium 6 If pip is not installed on your system, you can easily install it by running: python get-pip.py If pip is not installed on your system, you can easily install it by running: python get-pip.py
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 9 Select Run