Writing a simple test

For our example, we will write a simple test that will verify that our company website page loads and shows the correct title that we have coded in our HTML header. We log back into our development server, where we have our web server set up:

  1. We are going to write our test in the same directory as our HTML code, so start by moving into the html directory:
    cd /usr/local/var/www/html/
    
  2. Create a new file called selenium_test.py and open it with your code or text editor.
  3. If you are not familiar with coding in Python, it is not too complex and is very similar to JavaScript. Start by adding the following code, which will add the specific dependencies and modules we need for our test:
     1 import unittest 2 import time 3 from selenium ...

Get Learning Splunk Web Framework now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.