---
title: Automate Browser Testing with Selenium
slug: technical/automate-browser-testing-with-selenium
docTags: 
createdAt: 2025-03-11T06:58:09.587Z
---

BrightSign users running BrightSignOS 8.3.22 or above can now automate browser testing using the Selenium [WebDriver](https://www.selenium.dev/documentation/en/webdriver/) and [roHtmlWidget](docId\:xljq5_YhDmA2SSmpZimtK). Previously, Selenium could not establish a connection to BrightSign devices due to version number incompatibility.

The Selenium WebDriver can connect to *roHtmlWidget* through the [Web Inspector](docId:4qlK1krr1cnx7xypWXRY5) and drive test cases. To establish this, enable a remote debugging port on *roHtmlWidget*:

# roHtmlWidget Creation

```text
rect=CreateObject("roRectangle", 0, 0, width, height)
config = {
	inspector_server: {port: 6813}
	url: "about:blank"
}
htmlWidget = CreateObject("roHtmlWidget", rect, config)
```

The Chrome WebDriver and BrightSign Chromium version must match. Chromium 69 is built into BrightSignOS 8.3, so specify ChromeDriver 2.41.0 in *package.json*:

# package.json

```text
{
  "dependencies": {
    "chromedriver": "2.41.0",
    "selenium-webdriver": "*"
  }
}
```

The code block below connects to the remote inspector and loads a web page, showing how Selenium connects to a player and sends commands. Remote access (which is an optional parameter) is enabled here:

# main.js

```text
// main.js
var chromeDriver = require('chromedriver'), // Auto install ChromeDriver
    webdriver = require('selenium-webdriver'),
    By = webdriver.By,
    until = webdriver.until;

var chrome = require("selenium-webdriver/chrome");
var options = new chrome.Options();
options.options_["debuggerAddress"] = "172.30.1.192:6813"; // Replace this with your own remote ip/port
var driver = new webdriver.Builder()
    .forBrowser('chrome')
    .setChromeOptions(options)
    .build();

function start() {
  driver.get('https://www.brightsign.biz'); 
  setTimeout(function () {console.log('finished');}, 10000);
}

process.on('SIGTERM', function shutdown() {
  driver.quit();
});

start();
```

The selenium\_test.tar.gz file below is a sample application. It should be extracted and installed on a desktop PC using `npm install.`

::File{src="https://api.archbee.com/api/presign/TYAqEnq_Txckpox4eAKHe-AXdu1To1FBH6FyL5IiGMD-20250415-183456.gz" label="selenium_test.tar.gz"}

This *autorun.brs* must be installed on the BrightSign player:

::File{src="https://api.archbee.com/api/presign/TYAqEnq_Txckpox4eAKHe-FwZMvRRptZp9VuuozgYNs-20250415-183605.brs" label="autorun.brs"}

