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.|
You should now have the following directory structure (we will assume you created the
opentestdirectory in the root of the C: drive; if your path differs, please adjust the commands in the following steps accordingly):
C:\opentest ├── server │ └── server.yaml ├── actor1 │ └── actor.yaml └── test-repo └── ...
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.
Open the test actor configuration file ("C:\opentest\actor1\actor.yaml") in any text editor (we highly recommend VS Code). Find the
seleniumsection in the file and change the value of the
chromeDriverExePathparameter in this section to point to the Chrome WebDriver executable file. Here’s how that section should look like:
... selenium: desiredCapabilities: 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.
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
Open the server’s web UI at http://localhost:3000.
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.
Go into the
C:\opentest\test-repo\tests\webdirectory 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.