Title: Lab 5
Course: Special Topics in Computer Programming (TEMPLATE) > Section: Competency Modules

Check schedule for due date

Objective:

In this lab you will use a tool called Selenium IDE to create and execute a test script, then copy your test script to Python and execute the Python script.

Steps for success:

1.  Install the Selenium IDE Plug-In for Firefox.  Refer to the attached "Selenium IDE Installation Instructions.pdf".  NOTE:  This Plug-In will be required for Labs 5, 6, 7 and 8.  It only needs to be installed ONCE for a specific Firefox profile.  Thus, you may need to install this Plug-In on multiple computers if you want to use more than one computer to do these labs.

2.  Download / install the Selenium Python package.  Refer to the attached “Install Selenium Python Package.pdf”.  NOTE:  This package will be required for Labs 5, 6, 7 and 8.  It needs to be installed once on each computer that you are going to use for these labs.  Since this package requires administrator rights for installation, it has been pre-loaded on selected computers at ACC, but MUST be downloaded and installed for use at home, especially for APT students.

3.  Review the Selenium IDE Demonstration video under “Watch It’ for Competency 5.  Pay particular attention on how to record web activity, how to save the test script, how to run the test script and how to export the test script to Python.

4.  Open the Firefox browser and click on the Selenium IDE icon.  Resize your windows so that you have Firefox on the right hand side of your screen and Selenium IDE on the left hand side of your screen (similar to what was shown in the video).

5.  Open a website of your choosing on the Firefox window (right hand side).  You are going to navigate through this website and Selenium will record all of the activity.  FOR SECURITY REASONS DO NOT select a website that requires the use of a logon or password.

6.  Copy the URL from your Firefox window on the right hand side into the “Base URL” field on the Selenium IDE window (left hand side).

7.  Click on the RED record button on the Selenium window (left hand side) and proceed to browse and navigate with Firefox on the web site you selected  (right hand side).   When you have finished browsing, click the RED button on the Selenium window to STOP recording.   Then on the left hand side, click on “File” then “Save Test Case As” and name your file as “yourlastnameLab5.html”

8.  Now click on the “Play Current Test Case” (second green arrow on the top of the Selenium IDE window).  (NOTE:  Please adjust the speed setting with the sliding button to the left of the green arrows to the slowest speed possible).  If you get an error message when running the script, it is most likely that the website you chose violated html rules.  There are two choices to resolve this problem 1) simply select a different web site and make a new recording or 2) edit the script as shown in the video.

9.  Once the Selenium test case is running successfully, you need to export the test case as a Python program.  (Click on “File”, “Export Test Case As”, “Python 2 / unittest / Web Driver”)

10. Make the following modifications to the generated code:

CHANGE  except NoSuchElementException, e: return False

TO            except NoSuchElementException as e: return False

CHANGE  except NoAlertPresentException, e: return False

TO           except NoAlertPresentException as e: return False

11.  Finally execute your modified Python module using IDLE and “Run Module"

12.  When you have finished this lab, please submit both your Selenium and Python scripting files and a test summary report.

Attached Files:
- Selenium IDE Installation Instructions(1).pdf
- Install Selenium Python Package(1).pdf