Automating Microsoft OfficeJS Word Add-in

Opcito Technologies
3 min readApr 12, 2022

The use of add-ins elevates the overall Office experience for many Microsoft Office users. There are more than 2,000 add-ins for Microsoft Office 365. The Office add-in platform allows for multiple development options, of which the Word add-in is one. To interact with the content in a Word document, you can utilize add-in commands that extend the Word UI and start task panes to run JavaScripts. All codes that you choose to run on the web browser will run in a Word add-in. In short, you can extend the Microsoft Word functionalities with add-ins. There are multiple Word add-ins that you can select from the Office Store. Some popular ones include Wikipedia, Emoji Keyboard, and Font Finder.

In one of Opcito’s recent business engagements, we came across an add-in automation requirement, and we found it remarkably interesting. The primary reason was the difference between automating an add-in and automating a web or a desktop application. When we tried to do our research, we could not find anything on the topic; not a single video or anything on eLearning sites, even the leading tech bloggers had very little information.

After a lot of R&D and trial and error, we finally discovered an approach to automate it with Appium’s WinAppDriver. We implemented this in Node.js using open-source automation tools and technologies. It’s best to have the correct combination of different tools and their versions. We will explain our add-in automation setup in this blog.

Pre-requisite: Tools, versions, and dependencies

You would need to install the following tools along with the specified versions:

  • WinAppDriver 1.1.3.0,
  • Node.js 8.17.0,
  • npm 6.13.4,
  • Appium 1.15.1,
  • Download Visual Studio 2017 with workload “Desktop development with C++” and Windows SDK 10 using the Visual Studio installer. Do not forget to turn on the developer mode on your system.

Once all the tools are installed. Follow the steps below to install the required dependencies:

  • Open command prompt in admin mode and go to the location of the project folder
  • Run command “npm install fsevent@2.1.3 -f”
  • Run command “npm install windows-build-tool@5.2.2”
  • Make sure you have all dependencies with the proper version number in the package.json file of the project.
  • Here are the required dependencies:
  • Run command “npm install” to install all dependencies.
  • A node module folder will be created after successfully running the npm install command, and the project’s folder structure will look like this:

Initiating driver

We have used the WD library as NodeJS Webdriver/Selenium 2 client in this setup. This library is meant to be a malleable implementation of the Webdriver protocol in Node.

By default, the host address is 127.0.0.1, and port 4723 is used. WD promiseChainRemote is used to define the type of driver… Read more.

--

--

Opcito Technologies

Product engineering experts specializing in DevOps, Containers, Cloud, Automation, Blockchain, Test Engineering, & Open Source Tech