/
Automated Browser Testing with Selenium

Automated Browser Testing with Selenium

BrightSign users running OS 8.3.22 can now automate browser testing using the Selenium WebDriver and roHtmlWidget. Previously, Selenium could not establish a connection to BrightSign devices due to version number incompatibility.

The Selenium WebDriver can connect to roHtmlWidget through the remote inspector and drive test cases. To establish this, enable a remote debugging port on roHtmlWidget:

roHtmlWidget creation
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
{ "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
// 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:

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







Related content

Enabling BrightScript-JavaScript Objects
Enabling BrightScript-JavaScript Objects
More like this
roHtmlWidgetEvent
roHtmlWidgetEvent
More like this
Displaying HTML without BrightAuthor
Displaying HTML without BrightAuthor
More like this
JavaScript APIs
JavaScript APIs
More like this
Node.js
More like this
Node.js Versions
Node.js Versions
More like this