Web testing with Selenium

For this tutorial we will assume you are using Chrome on Windows, but the steps are almost identical for other browser and OS combinations.

Video tutorial

Text-based tutorial

  1. If you haven’t done it already, please follow the instructions in the installation page, including the quick start section to install OpenTest and create the default configuration files.

    You should now have the following directory structure (we will assume you created the opentest directory in the root of the C: drive; if your path differs, please adjust the commands in the following steps accordingly):

    ├── server
    │   └── server.yaml
    ├── actor1
    │   └── actor.yaml
    └── test-repo
        └── ...
  2. Download the latest version of the Chrome WebDriver for Windows and extract it to C:\Selenium\chromedriver.exe. If you are using a different browser, you can find a list of links to the various browser drivers here.

  3. Open the test actor configuration file ("C:\opentest\actor1\actor.yaml") in any text editor (we highly recommend VS Code). Find the selenium section in the file and change the value of the chromeDriverExePath parameter in this section to point to the Chrome WebDriver executable file. Here’s how that section should look like:

            browserName: chrome
        chromeDriverExePath: C:/Selenium/chromedriver.exe

    Notice we used the forward slash character as path separator, to avoid using double backslashes, which can cause problems in some scenarios. This works well on all platforms, including Windows.

  4. Type the following two commands in two separate terminal windows to start the OpenTest server and actor:

    opentest server C:\opentest\server
    opentest actor C:\opentest\actor1
  5. Open the server’s web UI at http://localhost:3000.

  6. From the menu, select Session > Create Session From Template. Select the template GitHub tests and click Create session. Wait for the test session to complete. You should see the Chrome browser windows opening and closing as the tests are running.

What next?

  • Go into the C:\opentest\test-repo\tests\web directory and open up one of the files there to examine the structure of the test and play around with it. It’ll be easier to understand what’s going on if you first read the documentation on test structure and test action types.

  • Follow the Real life web testing with OpenTest tutorial to get a better understanding of some of the techniques available.

  • Ask a question in a GitHub issue.