How to automate the testing of game UI with Selenium and JS

by Hristo K June. 28, 17 0 Comment

In this tutorial, we’ll show you how you can use Selenium to automate the testing of game UI.  Selenium is by far the most popular web-application testing framework currently available. It works with various scripting languages such as Java, JavaScript, C#, PHP, Ruby, Python, Perl, has integrations with build systems and broad cross-browser support. Furthermore, Selenium has a very large community, it’s open source and freeware!

For this tutorial, we are going to use Data-Binding Sample that comes with Coherent GT. Using a similar approach, you can integrate the Selenium testing framework in your own game UI scenes.

Coherent GT Data-Binding Sample

JS Installation

The first thing you need to do is to install the node.js and the npm.

Build sample

Next, you need to open the project solution in Visual Studio, which you can find in the following directory:

After you open the solution, you need to build the project. This will generate an exe file with the name Sample_DataBinding, and it will be located at the following directory:

Configuration and run

Then you need to copy the folder with name test_driven in the sample folder, which has the same directory as the Sample_DataBinding.exe. After this, you need to install selenium-webdriver in the folder of the JS, which you can do by running the following commands from cmd.

After you install the selenium-webdriver, you need to change the current cmd location to the folder where the sample is located:

After you change the cmd location, you need to run the sample test with the command:

Finally, you need to make sure to provide the correct paths for your project if different.

Creating and editing the test

In order to create and edit the test, you need to launch the sample. Then, launch the debugger and open the web view of the test. Next, you can use the debugger to identify elements for the tests and change whatever you want. Finally, if you want to see the actual HTML document, which is loaded in the sample,  you can find it in the following directory:


JS Sample Test File

Here, you can see a basic sample test file written in JS:

Successful Test Run

Once the test is executed, the sample will be launched and log messages will be printed in the console. Then, if the test is a successful run, it will look like this:

Unsuccessful Test Run

However, if the test is an unsuccessful run, it will produce the following log:

This concludes this tutorial. If you would like to learn more about Selenium here are a few links to get you started:


Your feedback is important for us! If you have any questions about how to automate the testing of game UI using Selenium and JS, write a comment below or start a discussion in our Forum.


Social Shares

Related Articles

Leave a Comment

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload the CAPTCHA.